This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree 1 file changed +9
-11
lines changed
1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 1
1
library input_select_spec;
2
2
3
3
import '../_specs.dart' ;
4
+ import 'package:browser_detect/browser_detect.dart' ;
4
5
5
6
//TODO(misko): re-enabled disabled tests once we have forms.
6
7
@@ -619,29 +620,26 @@ main() {
619
620
it ('should require' , () {
620
621
compile (
621
622
'<select name="select" probe="i" ng-model="selection" multiple required>' +
622
- '<option>A</option>' +
623
- '<option>B</option>' +
623
+ '<option id=a-req >A</option>' +
624
+ '<option id=b-req >B</option>' +
624
625
'</select>' );
625
626
626
627
var element = scope.context['i' ].element;
627
- scope.apply (() {
628
- scope.context['selection' ] = [];
629
- });
630
-
628
+ scope.apply ('selection = []' );
631
629
expect (scope.context['form' ]['select' ].hasErrorState ('ng-required' )).toEqual (true );
632
630
expect (scope.context['form' ]['select' ].invalid).toEqual (true );
633
631
expect (scope.context['form' ]['select' ].pristine).toEqual (true );
634
632
635
- scope.apply (() {
636
- scope.context['selection' ] = ['A' ];
637
- });
638
-
633
+ scope.apply ('selection = ["A"]' );
639
634
expect (scope.context['form' ]['select' ].valid).toEqual (true );
640
635
expect (scope.context['form' ]['select' ].pristine).toEqual (true );
641
636
642
637
element.value = 'B' ;
638
+ if (browser.isIe) {
639
+ element.querySelector ('#a-req' ).selected = true ;
640
+ element.querySelector ('#b-req' ).selected = true ;
641
+ }
643
642
_.triggerEvent (element, 'change' );
644
-
645
643
expect (scope.context['form' ]['select' ].valid).toEqual (true );
646
644
expect (scope.context['form' ]['select' ].dirty).toEqual (true );
647
645
});
You can’t perform that action at this time.
0 commit comments