Skip to content

Commit

Permalink
tests: check for selected attribute, not property
Browse files Browse the repository at this point in the history
The tests were checking for `option.selected`, but Glimmer doesn't set
that properly. Instead, we check for `$(option).is('[selected]')`.
  • Loading branch information
James A. Rosen committed Jun 24, 2015
1 parent 0fc7904 commit b19a868
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions tests/acceptance/x-select-multiple-blockless-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ describe('XSelect: Multiple Selection', function() {
});

it('marks all selected values', function() {
expect(this.$('option:eq(1)')).to.be.selected;
expect(this.$('option:eq(2)')).to.be.selected;
expect(this.$('option:eq(0)').is('[selected]')).to.be.falsy;
expect(this.$('option:eq(1)').is('[selected]')).to.be.truthy;
expect(this.$('option:eq(2)').is('[selected]')).to.be.truthy;
});

describe('choosing the last option', function() {
Expand All @@ -53,8 +54,8 @@ describe('XSelect: Multiple Selection', function() {
controller.set('it', [controller.get('charles'), controller.get('stanley')]);
});
it('updates the selected option', function() {
expect(this.$('option:first')).to.be.selected;
expect(this.$('option:eq(2)')).to.be.selected;
expect(this.$('option:eq(0)').is('[selected]')).to.be.truthy;
expect(this.$('option:eq(2)').is('[selected]')).to.be.truthy;
});
});

Expand Down
9 changes: 5 additions & 4 deletions tests/acceptance/x-select-multiple-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ describe('XSelect: Multiple Selection', function() {
});

it('marks all selected values', function() {
expect(this.$('option:eq(1)')).to.be.selected;
expect(this.$('option:eq(2)')).to.be.selected;
expect(this.$('option:eq(0)').is('[selected]')).to.be.falsy;
expect(this.$('option:eq(1)').is('[selected]')).to.be.truthy;
expect(this.$('option:eq(2)').is('[selected]')).to.be.truthy;
});

describe('choosing the last option', function() {
Expand All @@ -53,8 +54,8 @@ describe('XSelect: Multiple Selection', function() {
controller.set('selections', [controller.get('charles'), controller.get('stanley')]);
});
it('updates the selected option', function() {
expect(this.$('option:first')).to.be.selected;
expect(this.$('option:eq(2)')).to.be.selected;
expect(this.$('option:eq(0)').is('[selected]')).to.be.truthy;
expect(this.$('option:eq(2)').is('[selected]')).to.be.truthy;
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/x-select-single-blockless-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('XSelect: Single Selection Blockless', function() {
});

it('placeholder is the default selected option', function() {
expect(this.$('option:eq(1)')).to.be.selected;
expect(this.$('option:eq(1)').is('[selected]')).to.be.truthy;
});

describe('choosing the last option', function() {
Expand All @@ -66,7 +66,7 @@ describe('XSelect: Single Selection Blockless', function() {
controller.set('it', controller.get('charles'));
});
it('updates the selected option', function() {
expect(this.$('option:eq(3)')).to.be.selected;
expect(this.$('option:eq(3)').is('[selected]')).to.be.truthy;
});
});

Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/x-select-single-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('XSelect: Single Selection', function() {
});

it('marks the selected value', function() {
expect(this.$('option:eq(1)')).to.be.selected;
expect(this.$('option:eq(1)').is('[selected]')).to.be.truthy;
});

describe('choosing the last option', function() {
Expand All @@ -61,7 +61,7 @@ describe('XSelect: Single Selection', function() {
controller.set('it', controller.get('charles'));
});
it('updates the selected option', function() {
expect(this.$('option:first')).to.be.selected;
expect(this.$('option:eq(0)').is('[selected]')).to.be.truthy;
});
});

Expand Down

0 comments on commit b19a868

Please sign in to comment.