Skip to content

Commit

Permalink
Modify collapse.js unit test
Browse files Browse the repository at this point in the history
The unit test would execute `hide` on an already hidden element, and
then check if it has height set (which is added by the transition). This
only worked previously, because collapse.js erroniuosly executed
`toggle` which then trigged `show` instead of `hide`. Now that `hide` is
actually executed, no transition happens, so the height value is not set
by the animation. Hence in order to test the `hide` animation, the
element must first be shown.
  • Loading branch information
Nikita240 committed Feb 13, 2015
1 parent f17c64f commit b13efde
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/assets/js/customize.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/tests/unit/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $(function () {
})

test('should hide a collapsed element', function () {
var $el = $('<div class="collapse"/>').bootstrapCollapse('hide')
var $el = $('<div class="collapse in"/>').bootstrapCollapse('hide')

ok(!$el.hasClass('in'), 'does not have class "in"')
ok(/height/i.test($el.attr('style')), 'has height set')
Expand Down

0 comments on commit b13efde

Please sign in to comment.