Fix trigger shown and hidden events for dropdown #16865
+34
−2
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED
Commit: 98ccf83
Build details: https://travis-ci.org/twbs-savage/bootstrap/builds/72183457
(Please note that this is a fully automated comment.)
js/dropdown.js
| @@ -51,7 +51,7 @@ | ||
| if (e.isDefaultPrevented()) return | ||
| $this.attr('aria-expanded', 'false') | ||
| - $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) | ||
| + $parent.removeClass('open').trigger(e = $.Event('hidden.bs.dropdown', relatedTarget)) |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
js/dropdown.js
| @@ -85,7 +85,7 @@ | ||
| $parent | ||
| .toggleClass('open') | ||
| - .trigger('shown.bs.dropdown', relatedTarget) | ||
| + .trigger(e = $.Event('shown.bs.dropdown', relatedTarget)) |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
js/tests/unit/dropdown.js
| + + '<li><a href="#">Secondary link</a></li>' | ||
| + + '<li><a href="#">Something else here</a></li>' | ||
| + + '<li class="divider"/>' | ||
| + + '<li><a href="#">Another link</a></li>' | ||
| + + '</ul>' | ||
| + + '</li>' | ||
| + + '</ul>' | ||
| + var $dropdown = $(dropdownHTML) | ||
| + .appendTo('#qunit-fixture') | ||
| + .find('[data-toggle="dropdown"]') | ||
| + .bootstrapDropdown() | ||
| + var done = assert.async() | ||
| + | ||
| + $dropdown.parent('.dropdown') | ||
| + .on('shown.bs.dropdown', function (e) { | ||
| + assert.notStrictEqual(typeof e, 'undefined'); |
|
Needs to assert that
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
js/tests/unit/dropdown.js
| + + '<li><a href="#">Another link</a></li>' | ||
| + + '</ul>' | ||
| + + '</li>' | ||
| + + '</ul>' | ||
| + var $dropdown = $(dropdownHTML) | ||
| + .appendTo('#qunit-fixture') | ||
| + .find('[data-toggle="dropdown"]') | ||
| + .bootstrapDropdown() | ||
| + var done = assert.async() | ||
| + | ||
| + $dropdown.parent('.dropdown') | ||
| + .on('shown.bs.dropdown', function (e) { | ||
| + assert.notStrictEqual(typeof e, 'undefined'); | ||
| + }) | ||
| + .on('hidden.bs.dropdown', function (e) { | ||
| + assert.notStrictEqual(typeof e, 'undefined') |
|
Needs to assert that
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
|
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED
Commit: 6aafcfb
Build details: https://travis-ci.org/twbs-savage/bootstrap/builds/72423124
(Please note that this is a fully automated comment.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
it's a fix for #16828
Thanks to @DaGLiMiOuX