-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #454 from Westbrook/grid-changed
Update layout correctly when changing the value of `grid`
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!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 | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS | ||
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 | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>iron-list test</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../iron-test-helpers/mock-interactions.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
<script src="../../test-fixture/test-fixture-mocha.js"></script> | ||
|
||
<link rel="import" href="fixtures/helpers.html"> | ||
<link rel="import" href="fixtures/x-grid.html"> | ||
|
||
</head> | ||
<body> | ||
<!-- Issue: web-component-tester/issues/505 --> | ||
<script>void(0)</script> | ||
|
||
<test-fixture id="trivialList"> | ||
<template> | ||
<x-grid></x-grid> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
|
||
suite('basic features', function() { | ||
var list, container; | ||
|
||
setup(function() { | ||
container = fixture('trivialList'); | ||
list = container.list; | ||
}); | ||
|
||
test('check from grid=true to grid=false and back', function() { | ||
// Physical scroll bar causes there to be less columns than expected. | ||
// Force list to be wide enough to allow for 3 columns and the scroller. | ||
list.style.width = '320px'; | ||
container.data = buildDataSet(100); | ||
PolymerFlush(); | ||
assert.equal(list.lastVisibleIndex, 8); | ||
assert.equal(list._scrollHeight, 3400); | ||
list.grid = false; | ||
PolymerFlush(); | ||
assert.equal(list.lastVisibleIndex, 2); | ||
assert.equal(list._scrollHeight, 10000); | ||
list.grid = true; | ||
PolymerFlush(); | ||
assert.equal(list.lastVisibleIndex, 8); | ||
assert.equal(list._scrollHeight, 3400); | ||
}); | ||
|
||
test('check from grid=false to grid=true and back', function() { | ||
// Physical scroll bar causes there to be less columns than expected. | ||
// Force list to be wide enough to allow for 3 columns and the scroller. | ||
list.style.width = '320px'; | ||
list.grid = false; | ||
container.data = buildDataSet(100); | ||
PolymerFlush(); | ||
assert.equal(list.lastVisibleIndex, 2); | ||
assert.equal(list._scrollHeight, 10000); | ||
list.grid = true; | ||
PolymerFlush(); | ||
assert.equal(list.lastVisibleIndex, 8, 'Grid should show more items.'); | ||
assert.equal(list._scrollHeight, 3400); | ||
list.grid = false; | ||
PolymerFlush(); | ||
assert.equal(list.lastVisibleIndex, 2); | ||
assert.equal(list._scrollHeight, 10000); | ||
}); | ||
|
||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
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