-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Closes #21055: Prevents ScrollSpy from clearing item when Safari rubberbands #21056
Changes from all commits
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 |
---|---|---|
|
@@ -285,6 +285,50 @@ $(function () { | |
.scrollTop(201) | ||
}) | ||
|
||
QUnit.test('should NOT clear selection if above the first section and first section is at the top', function (assert) { | ||
assert.expect(4) | ||
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. No magic number: 4 no-magic-numbers |
||
var done = assert.async() | ||
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. Unexpected var, use let or const instead no-var |
||
|
||
var sectionHTML = '<div id="header" style="height: 500px;"></div>' | ||
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. Unexpected var, use let or const instead no-var |
||
+ '<nav id="navigation" class="navbar">' | ||
+ '<ul class="nav navbar-nav">' | ||
+ '<li><a id="one-link" class="nav-link active" href="#one">One</a></li>' | ||
+ '<li><a id="two-link" class="nav-link" href="#two">Two</a></li>' | ||
+ '<li><a id="three-link" class="nav-link" href="#three">Three</a></li>' | ||
+ '</ul>' | ||
+ '</nav>' | ||
$(sectionHTML).appendTo('#qunit-fixture') | ||
|
||
var negativeHeight = -10 | ||
var startOfSectionTwo = 101 | ||
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. Unexpected var, use let or const instead no-var 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. Unexpected var, use let or const instead no-var |
||
|
||
var scrollspyHTML = '<div id="content" style="height: 200px; overflow-y: auto;">' | ||
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. Unexpected var, use let or const instead no-var 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. Unexpected var, use let or const instead no-var |
||
+ '<div id="one" style="height: 100px;"/>' | ||
+ '<div id="two" style="height: 100px;"/>' | ||
+ '<div id="three" style="height: 100px;"/>' | ||
+ '<div id="spacer" style="height: 100px;"/>' | ||
+ '</div>' | ||
var $scrollspy = $(scrollspyHTML).appendTo('#qunit-fixture') | ||
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. Unexpected var, use let or const instead no-var |
||
|
||
$scrollspy | ||
.bootstrapScrollspy({ | ||
target: '#navigation', | ||
offset: $scrollspy.position().top | ||
}) | ||
.one('scroll', function () { | ||
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. Unexpected function expression prefer-arrow-callback |
||
assert.strictEqual($('.active').length, 1, '"active" class on only one element present') | ||
assert.strictEqual($('.active').is('#two-link'), true, '"active" class on second section') | ||
$scrollspy | ||
.one('scroll', function () { | ||
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. Unexpected function expression prefer-arrow-callback |
||
assert.strictEqual($('.active').length, 1, '"active" class on only one element present') | ||
assert.strictEqual($('.active').is('#one-link'), true, '"active" class on first section') | ||
done() | ||
}) | ||
.scrollTop(negativeHeight) | ||
}) | ||
.scrollTop(startOfSectionTwo) | ||
}) | ||
|
||
QUnit.test('should correctly select navigation element on backward scrolling when each target section height is 100%', function (assert) { | ||
assert.expect(5) | ||
var navbarHtml = | ||
|
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.
'QUnit' is not defined no-undef
Unexpected function expression prefer-arrow-callback