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

Commit 3f3f26f

Browse files
matskomhevery
authored andcommitted
chore(test): fix final disabled input test
Closes #797
1 parent 8d6acce commit 3f3f26f

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

test/directive/input_select_spec.dart

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -865,43 +865,46 @@ main() {
865865
});
866866

867867

868-
// TODO(misko): re-enable once we support group by
869-
xit('should bind to scope value and group', () {
870-
createSelect({
871-
'ng-model': 'selected',
872-
'ng-options': 'item.name group by item.group for item in values'
873-
});
868+
it('should bind to scope value and group', () {
869+
var element = _.compile(
870+
'<select ng-model="selected" probe="p">'
871+
'<optgroup label=\'{{ group["title"] }}\' ng-repeat="group in values">'
872+
'<option value=\'{{ item["val"] }}\' '
873+
'ng-repeat=\'item in group["items"]\'>{{ item["name"] }}</option>'
874+
'</optgroup>'
875+
'</select>');
874876

875877
scope.apply(() {
876-
scope.context['values'] = [{'name': 'A'},
877-
{'name': 'B', group: 'first'},
878-
{'name': 'C', group: 'second'},
879-
{'name': 'D', group: 'first'},
880-
{'name': 'E', group: 'second'}];
881-
scope.context['selected'] = scope.context['values'][3];
878+
scope.context['values'] = [
879+
{ 'title': 'first', 'items':
880+
[{ 'val':'a', 'name' : 'A' }, { 'val':'c', 'name' : 'C' } ]},
881+
{ 'title': 'second', 'items':
882+
[{ 'val':'b', 'name' : 'B' }, { 'val':'d', 'name' : 'D' } ]}
883+
];
884+
scope.context['selected'] = scope.context['values'][1]['items'][0]['val'];
882885
});
883886

884-
expect(element).toEqualSelect(['A', 'B', ['D'], 'C', 'E']);
887+
expect(element).toEqualSelect(['a', 'c', ['b'], 'd']);
885888

886889
var first = element.querySelectorAll('optgroup')[0];
887890
var b = first.querySelectorAll('option')[0];
888891
var d = first.querySelectorAll('option')[1];
889-
expect(first.attr('label')).toEqual('first');
890-
expect(b.text).toEqual('B');
891-
expect(d.text).toEqual('D');
892+
expect(first.getAttribute('label')).toEqual('first');
893+
expect(b.text).toEqual('A');
894+
expect(d.text).toEqual('C');
892895

893896
var second = element.querySelectorAll('optgroup')[1];
894897
var c = second.querySelectorAll('option')[0];
895898
var e = second.querySelectorAll('option')[1];
896-
expect(second.attr('label')).toEqual('second');
897-
expect(c.text).toEqual('C');
898-
expect(e.text).toEqual('E');
899+
expect(second.getAttribute('label')).toEqual('second');
900+
expect(c.text).toEqual('B');
901+
expect(e.text).toEqual('D');
899902

900903
scope.apply(() {
901-
scope.context['selected'] = scope.context['values'][0];
904+
scope.context['selected'] = scope.context['values'][0]['items'][1]['val'];
902905
});
903906

904-
expect(element.value).toEqual('0');
907+
expect(element.value).toEqual('c');
905908
});
906909

907910

0 commit comments

Comments
 (0)