Created
June 12, 2014 18:54
-
-
Save leepfrog/da4959b1728621b3fe59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test('selections should be populated as checkboxes are marked', function() { | |
| expect(4); | |
| var selections = Em.A(); | |
| var testData = { | |
| models: Em.A([ | |
| Em.Object.create({ id: 1, name: "Foo", desc: "Hey"}), | |
| Em.Object.create({ id: 2, name: "Bar", desc: "World"}), | |
| ]), | |
| value: selections | |
| }; | |
| // Special helper used to render a component into the test view | |
| setupComponentTestView({ | |
| app: App, | |
| widgetName: 'checkbox-list', | |
| args: testData, | |
| }); | |
| var checkboxes = find('ul.checkbox-list input[type=checkbox]'); | |
| equal(selections.get('length'), 0, 'valueData should be empty initially'); | |
| click(checkboxes.first()); | |
| equal(selections.get('length'), 1, 'valueData should have a single element after clicking unchecked box'); | |
| click(checkboxes.last()); | |
| equal(selections.get('length'), 2, 'valueData should have two elements after clicking unchecked box'); | |
| click(checkboxes.last()); | |
| equal(selections.get('length'), 1, 'valueData should have a single element after unclicking the checked box'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment