-
Notifications
You must be signed in to change notification settings - Fork 129
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 #375 from admwx7/master
Fixes #373 allowing support for parents to use <content> or <slot>
- Loading branch information
Showing
5 changed files
with
130 additions
and
7 deletions.
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,30 @@ | ||
<!-- | ||
@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 | ||
--> | ||
|
||
<link rel="import" href="../../polymer/polymer.html"> | ||
<link rel="import" href="../iron-list.html"> | ||
|
||
<dom-module id="o-list"> | ||
<template> | ||
<iron-list id="list" items="{{items}}"> | ||
<content> | ||
<template> | ||
<div class="default-template"> | ||
[[item.index]] | ||
</div> | ||
</template> | ||
</content> | ||
</iron-list> | ||
</template> | ||
</dom-module> | ||
|
||
<script> | ||
Polymer({is: 'o-list'}); | ||
</script> |
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,84 @@ | ||
<!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="../../web-component-tester/browser.js"></script> | ||
|
||
<link rel="import" href="helpers.html"> | ||
<link rel="import" href="o-list.html"> | ||
|
||
</head> | ||
<body> | ||
|
||
<test-fixture id="defaultTemplateList"> | ||
<template> | ||
<o-list></o-list> | ||
</template> | ||
</test-fixture> | ||
|
||
<test-fixture id="templateOverloadList"> | ||
<template> | ||
<o-list> | ||
<template> | ||
<div class="overloaded-template">[[item.index]]</div> | ||
</template> | ||
</o-list> | ||
</template> | ||
</test-fixture> | ||
|
||
<script> | ||
|
||
suite('template overloading', function() { | ||
var list; | ||
|
||
setup(function() { | ||
list = fixture('templateOverloadList'); | ||
}); | ||
|
||
test('check physical item size', function(done) { | ||
var setSize = 10; | ||
list.items = buildDataSet(setSize); | ||
|
||
flush(function() { | ||
assert.equal(list.items.length, setSize); | ||
done(); | ||
}); | ||
}); | ||
|
||
test('check item template', function(done) { | ||
list.items = buildDataSet(1); | ||
|
||
flush(function() { | ||
assert.equal(list.$.list.$.items.querySelectorAll('.overloaded-template').length, 1); | ||
done(); | ||
}); | ||
}); | ||
|
||
test('check count of physical items', function(done) { | ||
var setSize = 1; | ||
list.items = buildDataSet(setSize); | ||
|
||
flush(function() { | ||
assert.equal(Polymer.dom(list).querySelectorAll('*').length - 1, setSize); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |