This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
Fixes #168, scrollbutton glitch, tests added #169
Open
felvhage
wants to merge
15
commits into
PolymerElements:master
Choose a base branch
from
felvhage:felvhage-patch-fix168
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
247ef9d
Fixes #168
felvhage e1663d2
Tests for scrollable paper-tabs
felvhage ad04842
integrate scrollable.html into test-suite
felvhage 8597a06
Scrollable tests refined
felvhage ca12410
Fixed Shadow-DOM tests
felvhage 66f5b7a
Fix Whitespace hopefully
felvhage 9aa3b93
Trying Zoom in Percentage instead of numeric, to fix build
felvhage 8410d9a
Zoom-Test removed to fix Build
felvhage 47a7599
Reduced to the most simple test, to track down problem in Firefox
felvhage 6b5f63f
Excluding shadow-dom tests for scrollable to fix build
felvhage 06e708c
Removed all scrollable tests, to fix build
felvhage 736e18d
Reverted change in paper-tabs. There should be no difference at all, …
felvhage d39aa28
Tests back to where i started
felvhage 4af9bdc
Tests added to index.html
felvhage 670882d
Actual fix inserted again.
felvhage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<!doctype html> | ||
<!-- | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
|
||
<html> | ||
<head> | ||
|
||
<title>paper-tabs-scrollable</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
|
||
<link rel="import" href="../paper-tabs.html"> | ||
|
||
</head> | ||
<body> | ||
|
||
<test-fixture id="basic"> | ||
<template> | ||
<paper-tabs> | ||
<paper-tab>ITEM ONE</paper-tab> | ||
<paper-tab>ITEM TWO</paper-tab> | ||
<paper-tab>ITEM THREE</paper-tab> | ||
</paper-tabs> | ||
</template> | ||
</test-fixture> | ||
|
||
<test-fixture id="scrollable"> | ||
<template> | ||
<paper-tabs scrollable style="width: 500px;"> | ||
<paper-tab style="width: 150px">ITEM ONE</paper-tab> | ||
<paper-tab style="width: 150px">ITEM TWO</paper-tab> | ||
<paper-tab style="width: 150px">ITEM THREE</paper-tab> | ||
<paper-tab style="width: 150px">ITEM FOUR</paper-tab> | ||
</paper-tabs> | ||
</template> | ||
</test-fixture> | ||
|
||
<test-fixture id="zoomed"> | ||
<template> | ||
<paper-tabs scrollable style="width: 500px;zoom: 1.1;"> | ||
<paper-tab style="width: 150px">ITEM ONE</paper-tab> | ||
<paper-tab style="width: 150px">ITEM TWO</paper-tab> | ||
<paper-tab style="width: 150px">ITEM THREE</paper-tab> | ||
<paper-tab style="width: 150px">ITEM FOUR</paper-tab> | ||
</paper-tabs> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
suite('scrollables suite', function() { | ||
|
||
var tabs, tabsContainer, leftScrollbutton, rightScrollbutton; | ||
|
||
suite('non-scrollable paper-tabs', function() { | ||
|
||
setup(function () { | ||
tabs = fixture('basic'); | ||
leftScrollbutton = Polymer.dom(tabs.root).querySelectorAll('paper-icon-button')[0]; | ||
rightScrollbutton = Polymer.dom(tabs.root).querySelectorAll('paper-icon-button')[1]; | ||
tabsContainer = tabs.$.tabsContainer; | ||
}); | ||
|
||
test('have no scrollbuttons', function() { | ||
assert.isTrue(leftScrollbutton.offsetWidth===0); | ||
assert.isTrue(rightScrollbutton.offsetWidth===0); | ||
}); | ||
|
||
}); | ||
|
||
suite('scrollable paper-tabs', function() { | ||
|
||
setup(function () { | ||
tabs = fixture('scrollable'); | ||
leftScrollbutton = Polymer.dom(tabs.root).querySelectorAll('paper-icon-button')[0]; | ||
rightScrollbutton = Polymer.dom(tabs.root).querySelectorAll('paper-icon-button')[1]; | ||
tabsContainer = tabs.$.tabsContainer; | ||
}); | ||
|
||
test('have scrollbuttons', function() { | ||
assert.isTrue(leftScrollbutton.offsetWidth>0); | ||
assert.isTrue(rightScrollbutton.offsetWidth>0); | ||
}); | ||
|
||
test('when scroll-offset is 0, then the left scrollbutton is faded out', function(done) { | ||
|
||
Polymer.Base.async(function() { | ||
assert.equal(tabsContainer.scrollLeft, 0); | ||
assert.isTrue(leftScrollbutton.classList.contains('not-visible')); | ||
assert.isFalse(rightScrollbutton.classList.contains('not-visible')); | ||
done(); | ||
}, 100); | ||
|
||
}); | ||
|
||
test('when scroll-offset is \'max\', then the right scrollbutton is faded out', function(done) { | ||
//Set scrollLeft to a very high number. Will scroll to outermost position. | ||
tabsContainer.scrollLeft = 99999; | ||
|
||
Polymer.Base.async(function() { | ||
assert.isFalse(leftScrollbutton.classList.contains('not-visible')); | ||
assert.isTrue(rightScrollbutton.classList.contains('not-visible')); | ||
done(); | ||
}, 100); | ||
|
||
}); | ||
|
||
}); | ||
|
||
suite('zoomed, scrollable paper-tabs', function() { | ||
|
||
setup(function () { | ||
tabs = fixture('zoomed'); | ||
leftScrollbutton = Polymer.dom(tabs.root).querySelectorAll('paper-icon-button')[0]; | ||
rightScrollbutton = Polymer.dom(tabs.root).querySelectorAll('paper-icon-button')[1]; | ||
tabsContainer = tabs.$.tabsContainer; | ||
}); | ||
|
||
test('the right scrollbutton is faded out, even if scrolloffset is fractional due to zoom', function(done) { | ||
//Set scrollLeft to a very high number. Will scroll to outermost position. | ||
tabsContainer.scrollLeft = 99999; | ||
//Using Zoom-Fixture will let tabsContainer.scrollLeft become fractional in certain browsers (i.e. Chrome) | ||
|
||
Polymer.Base.async(function() { | ||
assert.isFalse(leftScrollbutton.classList.contains('not-visible')); | ||
assert.isTrue(rightScrollbutton.classList.contains('not-visible')); | ||
done(); | ||
}, 100); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This needs to be wrapped in something like
so that it doesn't attempt these if the browser doesn't support
zoom
.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.
reminder :)