From b19a868e1be069d4621ecf1d87f5301656dfde39 Mon Sep 17 00:00:00 2001 From: "James A. Rosen" Date: Tue, 23 Jun 2015 19:07:04 -0500 Subject: [PATCH] tests: check for selected attribute, not property The tests were checking for `option.selected`, but Glimmer doesn't set that properly. Instead, we check for `$(option).is('[selected]')`. --- tests/acceptance/x-select-multiple-blockless-test.js | 9 +++++---- tests/acceptance/x-select-multiple-test.js | 9 +++++---- tests/acceptance/x-select-single-blockless-test.js | 4 ++-- tests/acceptance/x-select-single-test.js | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/acceptance/x-select-multiple-blockless-test.js b/tests/acceptance/x-select-multiple-blockless-test.js index f1a75cc..fa6b088 100644 --- a/tests/acceptance/x-select-multiple-blockless-test.js +++ b/tests/acceptance/x-select-multiple-blockless-test.js @@ -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() { @@ -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; }); }); diff --git a/tests/acceptance/x-select-multiple-test.js b/tests/acceptance/x-select-multiple-test.js index ece899b..2ed7a7f 100644 --- a/tests/acceptance/x-select-multiple-test.js +++ b/tests/acceptance/x-select-multiple-test.js @@ -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() { @@ -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; }); }); diff --git a/tests/acceptance/x-select-single-blockless-test.js b/tests/acceptance/x-select-single-blockless-test.js index 6695d5e..b5c6413 100644 --- a/tests/acceptance/x-select-single-blockless-test.js +++ b/tests/acceptance/x-select-single-blockless-test.js @@ -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() { @@ -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; }); }); diff --git a/tests/acceptance/x-select-single-test.js b/tests/acceptance/x-select-single-test.js index 2a0842c..289268d 100644 --- a/tests/acceptance/x-select-single-test.js +++ b/tests/acceptance/x-select-single-test.js @@ -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() { @@ -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; }); });