|
38 | 38 | var el = singleConfigured;
|
39 | 39 | // Nothing selected
|
40 | 40 | assert.strictEqual(el.selected, null);
|
| 41 | + assert.isFalse(el.isSelected(el.items[0])); |
| 42 | + assert.isFalse(el.isSelected(el.items[1])); |
| 43 | + assert.isFalse(el.isSelected(el.items[2])); |
41 | 44 | // Select 0
|
42 | 45 | el.select(el.items[0]);
|
43 | 46 | assert.strictEqual(el.selected, el.items[0]);
|
| 47 | + assert.isTrue(el.isSelected(el.items[0])); |
| 48 | + assert.isFalse(el.isSelected(el.items[1])); |
| 49 | + assert.isFalse(el.isSelected(el.items[2])); |
44 | 50 | // Re-select 0
|
45 | 51 | el.select(el.items[0]);
|
46 | 52 | assert.strictEqual(el.selected, el.items[0]);
|
| 53 | + assert.isTrue(el.isSelected(el.items[0])); |
| 54 | + assert.isFalse(el.isSelected(el.items[1])); |
| 55 | + assert.isFalse(el.isSelected(el.items[2])); |
47 | 56 | // Select 2
|
48 | 57 | el.select(el.items[2]);
|
49 | 58 | assert.strictEqual(el.selected, el.items[2]);
|
| 59 | + assert.isFalse(el.isSelected(el.items[0])); |
| 60 | + assert.isFalse(el.isSelected(el.items[1])); |
| 61 | + assert.isTrue(el.isSelected(el.items[2])); |
50 | 62 | // Toggle 2
|
51 | 63 | el.toggle = true;
|
52 | 64 | el.select(el.items[2]);
|
53 | 65 | assert.strictEqual(el.selected, null);
|
| 66 | + assert.isFalse(el.isSelected(el.items[0])); |
| 67 | + assert.isFalse(el.isSelected(el.items[1])); |
| 68 | + assert.isFalse(el.isSelected(el.items[2])); |
54 | 69 | // Toggle 2
|
55 | 70 | el.toggle = true;
|
56 | 71 | el.select(el.items[2]);
|
57 | 72 | assert.strictEqual(el.selected, el.items[2]);
|
| 73 | + assert.isFalse(el.isSelected(el.items[0])); |
| 74 | + assert.isFalse(el.isSelected(el.items[1])); |
| 75 | + assert.isTrue(el.isSelected(el.items[2])); |
58 | 76 | });
|
59 | 77 |
|
60 | 78 | test('multiple selection', function() {
|
61 | 79 | var el = multiConfigured;
|
62 | 80 | // Nothing selected
|
63 | 81 | assert.sameMembers(el.selected, []);
|
| 82 | + assert.isFalse(el.isSelected(el.items[0])); |
| 83 | + assert.isFalse(el.isSelected(el.items[1])); |
| 84 | + assert.isFalse(el.isSelected(el.items[2])); |
64 | 85 | // Select 0
|
65 | 86 | el.select(el.items[0]);
|
66 | 87 | assert.sameMembers(el.selected, [el.items[0]]);
|
| 88 | + assert.isTrue(el.isSelected(el.items[0])); |
| 89 | + assert.isFalse(el.isSelected(el.items[1])); |
| 90 | + assert.isFalse(el.isSelected(el.items[2])); |
67 | 91 | // Re-select 0
|
68 | 92 | el.select(el.items[0]);
|
69 | 93 | assert.sameMembers(el.selected, [el.items[0]]);
|
| 94 | + assert.isTrue(el.isSelected(el.items[0])); |
| 95 | + assert.isFalse(el.isSelected(el.items[1])); |
| 96 | + assert.isFalse(el.isSelected(el.items[2])); |
70 | 97 | // Select 2
|
71 | 98 | el.select(el.items[2]);
|
72 | 99 | assert.sameMembers(el.selected, [el.items[0], el.items[2]]);
|
| 100 | + assert.isTrue(el.isSelected(el.items[0])); |
| 101 | + assert.isFalse(el.isSelected(el.items[1])); |
| 102 | + assert.isTrue(el.isSelected(el.items[2])); |
73 | 103 | // Toggle 2
|
74 | 104 | el.toggle = true;
|
75 | 105 | el.select(el.items[2]);
|
76 | 106 | assert.sameMembers(el.selected, [el.items[0]]);
|
| 107 | + assert.isTrue(el.isSelected(el.items[0])); |
| 108 | + assert.isFalse(el.isSelected(el.items[1])); |
| 109 | + assert.isFalse(el.isSelected(el.items[2])); |
77 | 110 | // Toggle 2
|
78 | 111 | el.toggle = true;
|
79 | 112 | el.select(el.items[2]);
|
80 | 113 | assert.sameMembers(el.selected, [el.items[0], el.items[2]]);
|
| 114 | + assert.isTrue(el.isSelected(el.items[0])); |
| 115 | + assert.isFalse(el.isSelected(el.items[1])); |
| 116 | + assert.isTrue(el.isSelected(el.items[2])); |
81 | 117 | });
|
82 | 118 |
|
83 | 119 | test('bound defaults', function() {
|
|
0 commit comments