Skip to content

Commit

Permalink
[#9] - seed-element back in repo
Browse files Browse the repository at this point in the history
seed-element now back in the repo without being an external repository
that it was originally.
  • Loading branch information
pertrai1 committed Jan 3, 2015
1 parent 2693259 commit b2546cc
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 0 deletions.
20 changes: 20 additions & 0 deletions seed-element/seed-element.css
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;
}
97 changes: 97 additions & 0 deletions seed-element/seed-element.html
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>
56 changes: 56 additions & 0 deletions seed-element/test/basic-test.html
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>
29 changes: 29 additions & 0 deletions seed-element/test/index.html
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>

0 comments on commit b2546cc

Please sign in to comment.