-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding some tests to enhance shadow support
- Loading branch information
Florian Maffini
committed
Feb 13, 2017
1 parent
e610cd6
commit da3f8bd
Showing
8 changed files
with
214 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "paper-tree", | ||
"main": "paper-tree.html", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A custom element displaying a browsable tree.", | ||
"keywords": [ | ||
"tree", | ||
|
@@ -16,12 +16,12 @@ | |
"Florian Maffini <[email protected]>" | ||
], | ||
"dependencies": { | ||
"polymer": "Polymer/polymer#^1.4.0", | ||
"polymer": "Polymer/polymer#^1.7.0", | ||
"paper-menu": "PolymerElements/paper-menu#^1.2.2", | ||
"paper-menu-button": "PolymerElements/paper-menu-button#^1.5.2", | ||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.1.3", | ||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.1.4", | ||
"paper-item": "PolymerElements/paper-item#^1.2.1", | ||
"iron-icons": "PolymerElements/iron-icons#^1.1.3", | ||
"iron-icons": "PolymerElements/iron-icons#^1.2.0", | ||
"iron-icon": "PolymerElements/iron-icon#^1.0.12" | ||
}, | ||
"devDependencies": { | ||
|
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 was deleted.
Oops, something went wrong.
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,89 @@ | ||
<!doctype html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
|
||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../web-component-tester/browser.js"></script> | ||
|
||
<!-- Import the element to test --> | ||
<link rel="import" href="../paper-tree-node.html"> | ||
</head> | ||
<body> | ||
|
||
<!-- You can use the document as a place to set up your fixtures. --> | ||
<paper-tree-node></paper-tree-node> | ||
|
||
<script> | ||
var node = document.querySelector('paper-tree-node'); | ||
|
||
suite('<paper-tree-node>', function() { | ||
|
||
test('defines the default "data" property to `null`', function() { | ||
assert.equal(node.data, null); | ||
}); | ||
|
||
test('properly computes its classes', function() { | ||
// Some defaults tests | ||
var answer = node._computeClass(); | ||
assert.equal(answer, 'node-preicon '); | ||
|
||
answer = node._computeClass({}); | ||
assert.equal(answer, 'node-preicon '); | ||
|
||
// Ask for expanded with no children | ||
answer = node._computeClass({base: {open: true}}); | ||
assert.equal(answer, 'node-preicon '); | ||
|
||
// Ask for expanded with empty children | ||
answer = node._computeClass({base: {open: true, children:[]}}); | ||
assert.equal(answer, 'node-preicon '); | ||
|
||
// Ask for collapsed with children | ||
answer = node._computeClass({base: {open: false, children:[0]}}); | ||
assert.equal(answer, 'node-preicon collapsed'); | ||
|
||
// Ask for expanded with children | ||
answer = node._computeClass({base: {open: true, children:[0]}}); | ||
assert.equal(answer, 'node-preicon expanded'); | ||
}); | ||
|
||
test('properly computes its icon', function() { | ||
var answer = node._computeIcon(''); | ||
assert.equal(answer, 'folder'); | ||
|
||
answer = node._computeIcon('folder'); | ||
assert.equal(answer, 'folder'); | ||
}); | ||
|
||
test('ables to toggle its children', function() { | ||
node.data = { | ||
children: [], | ||
open: false | ||
}; | ||
|
||
// No children, open state is always false. | ||
node.toggleChildren(); | ||
assert.equal(node.data.open, false); | ||
|
||
// Same thing. | ||
node.data.open = true; | ||
node.toggleChildren(); | ||
assert.equal(node.data.open, false); | ||
|
||
// With children, open state is toggled properly. | ||
node.data.children = [1]; | ||
node.toggleChildren(); | ||
assert.equal(node.data.open, true); | ||
|
||
node.toggleChildren(); | ||
assert.equal(node.data.open, false); | ||
}); | ||
|
||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.