-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
Variable transition durations #25662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b06f41c
81bd16c
be57118
5c0b61f
ee6a836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,50 @@ $(function () { | |
| assert.strictEqual(typeof Util.isElement({}) === 'undefined', true) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getTransitionDurationFromElement should accept transition durations in milliseconds', function (assert) { | ||
| assert.expect(1) | ||
| var $div = $('<div style="transition: all 300ms ease-out;"></div>').appendTo($('#qunit-fixture')) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What did you do to detect this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the coverage, see #25783 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My 2 cents are, that the condition it should test should be:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed it to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said on my first message, this line : let transitionDuration = $(element).css('transition-duration')auto convert IMO jQuery use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jQuery takes care of this indeed (Also tested this in Chrome, FF, IE). IMO it's safe to remove this check as long as we depend on jQuery.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's jQuery which do that, IMO it's more |
||
|
|
||
| assert.strictEqual(Util.getTransitionDurationFromElement($div), 300) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getTransitionDurationFromElement should accept transition durations in seconds', function (assert) { | ||
| assert.expect(1) | ||
| var $div = $('<div style="transition: all .4s ease-out;"></div>').appendTo($('#qunit-fixture')) | ||
|
|
||
| assert.strictEqual(Util.getTransitionDurationFromElement($div), 400) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getTransitionDurationFromElement should get the first transition duration if multiple transition durations are defined', function (assert) { | ||
| assert.expect(1) | ||
| var $div = $('<div style="transition: transform .3s ease-out, opacity .2s;"></div>').appendTo($('#qunit-fixture')) | ||
|
|
||
| assert.strictEqual(Util.getTransitionDurationFromElement($div), 300) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getTransitionDurationFromElement should return 0 if transition duration is not defined', function (assert) { | ||
| assert.expect(1) | ||
| var $div = $('<div></div>').appendTo($('#qunit-fixture')) | ||
|
|
||
| assert.strictEqual(Util.getTransitionDurationFromElement($div), 0) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getTransitionDurationFromElement should return 0 if element is not found in DOM', function (assert) { | ||
| assert.expect(1) | ||
| var $div = $('#fake-id') | ||
|
|
||
| assert.strictEqual(Util.getTransitionDurationFromElement($div), 0) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getTransitionDurationFromElement should properly handle inherited transition durations', function (assert) { | ||
| assert.expect(1) | ||
| var $parent = $('<div style="transition-duration: 5s;"></div>') | ||
| var $child = $('<div style="transition-duration: inherit;"></div>') | ||
| $('#qunit-fixture').append($parent.append($child)) | ||
|
|
||
| assert.strictEqual(Util.getTransitionDurationFromElement($child), 5000) | ||
| }) | ||
|
|
||
| QUnit.test('Util.getUID should generate a new id uniq', function (assert) { | ||
| assert.expect(2) | ||
| var id = Util.getUID('test') | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a unit test for this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #25218 (review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can test when you have multi durations and when you have
msThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests are added: 05cef0a