-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
seed-element now back in the repo without being an external repository that it was originally.
- Loading branch information
Showing
4 changed files
with
202 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* @license | ||
* Copyright (c) 2014 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 | ||
*/ | ||
|
||
:host { | ||
display: block; | ||
} | ||
|
||
/* To ensure your styling works under the Shadow DOM polyfill, see | ||
www.polymer-project.org/docs/polymer/styling.html#directives */ | ||
polyfill-next-selector { content: ':host > h2'; } | ||
::content h2 { | ||
color: blue; | ||
} |
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,97 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2014 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 | ||
--> | ||
<link rel="import" href="../lib/polymer/polymer.html"> | ||
|
||
<!-- | ||
Element providing solution to no problem in particular. | ||
##### Example | ||
<seed-element></seed-element> | ||
@element seed-element | ||
@blurb Element providing solution to no problem in particular. | ||
@status alpha | ||
@homepage http://polymerlabs.github.io/seed-element | ||
--> | ||
<polymer-element name="seed-element" attributes="notitle author"> | ||
|
||
<template> | ||
|
||
<link rel="stylesheet" href="seed-element.css"> | ||
|
||
<h1>Hello from seed-element</h1> | ||
<content></content> | ||
|
||
</template> | ||
|
||
<script> | ||
|
||
Polymer({ | ||
/** | ||
* The `author` attribute sets an initial author | ||
* | ||
* @attribute author | ||
* @type string | ||
* @default 'Dimitri Glazkov' | ||
*/ | ||
author: 'Dimitri Glazkov', | ||
|
||
/** | ||
* `fancy` is a property that does something fancy. | ||
* | ||
* @property fancy | ||
* @type bool | ||
* @default false | ||
*/ | ||
fancy: false, | ||
|
||
ready: function() { | ||
// Ready is a lifecycle callback. | ||
// You can do setup work in here. | ||
// More info: http://www.polymer-project.org/docs/polymer/polymer.html#lifecyclemethods | ||
}, | ||
|
||
/** | ||
* The `sayHello` method will return a greeting. | ||
* | ||
* @method sayHello | ||
* @param {String} greeting Pass in a specific greeting. | ||
* @return {String} Returns a string greeting. | ||
*/ | ||
sayHello: function(greeting) { | ||
var response = greeting || 'Hello World!'; | ||
return 'seed-element says, ' + response; | ||
}, | ||
|
||
/** | ||
* The `seed-element-lasers-success` event is fired whenever we | ||
* call fireLasers. | ||
* | ||
* @event seed-element-lasers-success | ||
* @param {Object} detail | ||
* @param {string} detail.sound An amazing sound. | ||
*/ | ||
|
||
/** | ||
* The `fireLasers` method will fire the lasers. At least | ||
* it will dispatch an event that claims lasers were fired :) | ||
* | ||
* @method fireLasers | ||
*/ | ||
fireLasers: function() { | ||
this.fire('seed-element-lasers-success', { sound: 'Pew pew pew!' }); | ||
} | ||
|
||
}); | ||
|
||
</script> | ||
|
||
</polymer-element> |
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,56 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2014 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 | ||
--> | ||
<!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"> | ||
<title>seed-element</title> | ||
|
||
<script src="../../lib/webcomponentsjs/webcomponents.min.js"></script> | ||
<script src="../../lib/web-component-tester/browser.js"></script> | ||
|
||
<!-- Step 1: import the element to test --> | ||
<link rel="import" href="../seed-element.html"> | ||
</head> | ||
<body> | ||
|
||
<!-- You use the document as a place to set up your fixtures. --> | ||
<seed-element></seed-element> | ||
|
||
<script> | ||
var myEl = document.querySelector('seed-element'); | ||
|
||
suite('<seed-element>', function() { | ||
|
||
test('defines the "author" property', function() { | ||
assert.equal(myEl.author, 'Dimitri Glazkov'); | ||
}); | ||
|
||
test('says hello', function() { | ||
assert.equal(myEl.sayHello(), 'seed-element says, Hello World!'); | ||
|
||
var greetings = myEl.sayHello('greetings Earthlings'); | ||
assert.equal(greetings, 'seed-element says, greetings Earthlings'); | ||
}); | ||
|
||
test('fires lasers', function(done) { | ||
myEl.addEventListener('seed-element-lasers-success', function(event) { | ||
assert.equal(event.detail.sound, 'Pew pew pew!'); | ||
done(); | ||
}); | ||
myEl.fireLasers(); | ||
}); | ||
|
||
}); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2014 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 | ||
--> | ||
<!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"> | ||
<title>Tests</title> | ||
|
||
<script src="../../lib/webcomponentsjs/webcomponents.min.js"></script> | ||
<script src="../../lib/web-component-tester/browser.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
// Load and run all tests (.html, .js) as one suite: | ||
WCT.loadSuites([ | ||
'basic-test.html', | ||
]); | ||
</script> | ||
</body> | ||
</html> |