Skip to content

Commit

Permalink
Update select_test.html for Chrome 45.
Browse files Browse the repository at this point in the history
Update tests to reflect that Chrome 45+ no longer
incorrectly fires a 'change' event in 4 tests.

Signed-off-by: Seva Lotoshnikov <vlotoshnikov@gmail.com>
  • Loading branch information
joshbruning authored and sevaseva committed Aug 6, 2015
1 parent a8b05b5 commit 66f3e56
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions javascript/atoms/test/select_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,25 @@

action(elem);

// WebKit and IE9 standards mode fire change events when the
// checkbox isn't toggled.
assertChanges(
goog.userAgent.WEBKIT || bot.userAgent.IE_DOC_9 ? 1 : 0);
// Some browsers fire change events when the checkbox isn't toggled.
assertChanges(firesChangeEventIfNotToggled() ? 1 : 0);
assertFalse(bot.dom.isSelected(elem));
}

function firesChangeEventIfNotToggled() {
if (goog.userAgent.product.CHROME && bot.userAgent.isProductVersion(45)) {
// Chrome 45 and above do not fire the change event.
return false;
} else if (goog.userAgent.WEBKIT || bot.userAgent.IE_DOC_9) {
// Other browsers with goog.userAgent.WEBKIT fire the change event.
// IE 9 standards mode fires the change event.
return true;
}

// All other browsers do not fire the change event.
return false;
}

var testClickCannotSelectCheckboxWhenDefaultPrevented =
goog.partial(cannotSelectCheckboxWhenDefaultPrevented,
bot.action.click);
Expand Down Expand Up @@ -394,12 +406,8 @@
assertChanges(1);
assertTrue(bot.dom.isSelected(elem));
} else {
// IE9 standards mode and Chrome still fire the change event.
if (bot.userAgent.IE_DOC_9 || goog.userAgent.product.CHROME) {
assertChanges(1);
} else {
assertChanges(0);
}
// Some browsers fire change events when the checkbox isn't toggled.
assertChanges(firesChangeEventIfNotToggled() ? 1 : 0);
assertFalse(bot.dom.isSelected(elem));
}
}
Expand Down

0 comments on commit 66f3e56

Please sign in to comment.