Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit acd858e

Browse files
committed
test(select multiple): Need to explicitely select option on IE11
1 parent 34d1fb1 commit acd858e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

test/directive/ng_model_select_spec.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
library input_select_spec;
22

33
import '../_specs.dart';
4+
import 'package:browser_detect/browser_detect.dart';
45

56
//TODO(misko): re-enabled disabled tests once we have forms.
67

@@ -619,29 +620,27 @@ main() {
619620
it('should require', () {
620621
compile(
621622
'<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>' +
624625
'</select>');
625626

626627
var element = scope.context['i'].element;
627-
scope.apply(() {
628-
scope.context['selection'] = [];
629-
});
630-
628+
scope.apply('selection = []');
631629
expect(scope.context['form']['select'].hasErrorState('ng-required')).toEqual(true);
632630
expect(scope.context['form']['select'].invalid).toEqual(true);
633631
expect(scope.context['form']['select'].pristine).toEqual(true);
634632

635-
scope.apply(() {
636-
scope.context['selection'] = ['A'];
637-
});
638-
633+
scope.apply('selection = ["A"]');
639634
expect(scope.context['form']['select'].valid).toEqual(true);
640635
expect(scope.context['form']['select'].pristine).toEqual(true);
641636

642637
element.value = 'B';
638+
if (browser.isIe && browser.version >= "11" && browser.version < "12") {
639+
// IE11 needs this
640+
element.querySelector('#a-req').selected = true;
641+
element.querySelector('#b-req').selected = true;
642+
}
643643
_.triggerEvent(element, 'change');
644-
645644
expect(scope.context['form']['select'].valid).toEqual(true);
646645
expect(scope.context['form']['select'].dirty).toEqual(true);
647646
});

0 commit comments

Comments
 (0)