Skip to content

Commit 3ee6582

Browse files
committed
Update to bring generator up to date. Also swapped out to a cleaner smaller example component.
1 parent bc3d321 commit 3ee6582

9 files changed

+84
-108
lines changed

Diff for: .editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ root = true
33

44
[*]
55
indent_style = space
6-
indent_size = 4
6+
indent_size = 2
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true

Diff for: app/templates/_bower.json

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
2-
"name": "<%= name %>",
3-
"version": "0.0.1",
4-
"main": [
5-
"<%= name %>.html"
6-
],
7-
"ignore": [
8-
".*",
9-
"npm-debug.log",
10-
"Gruntfile.js",
11-
"sass",
12-
"bower_components",
13-
"node_modules",
14-
"test"
15-
],
16-
"dependencies": {
17-
"polymer": "~1.2.3",
18-
"px-theme": "https://github.com/PredixDev/px-theme.git#~0.4.0"
19-
},
20-
"devDependencies": {
21-
"iron-component-page" : "PolymerElements/iron-component-page#~v1.1.0",
22-
<%- devDependencies.join('\n ') %>
23-
"px-starter-kit-design": "https://github.com/PredixDev/px-starter-kit-design.git#~0.4.9"
24-
}
2+
"name": "<%= name %>",
3+
"version": "0.0.1",
4+
"main": [
5+
"<%= name %>.html"
6+
],
7+
"ignore": [
8+
".*",
9+
"npm-debug.log",
10+
"Gruntfile.js",
11+
"sass",
12+
"bower_components",
13+
"node_modules",
14+
"test"
15+
],
16+
"dependencies": {
17+
"polymer": "~1.2.3",
18+
"px-theme": "https://github.com/PredixDev/px-theme.git#~0.4.0"
19+
},
20+
"devDependencies": {
21+
"iron-component-page": "PolymerElements/iron-component-page#~v1.1.0",
22+
<%- devDependencies.join('\n ') %>
23+
"px-starter-kit-design": "https://github.com/PredixDev/px-starter-kit-design.git#~0.4.9"
24+
}
2525
}

Diff for: app/templates/doc/_demo.html

+15-26
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
11
<!doctype html>
22

33
<html>
4-
<head>
5-
<meta charset="utf-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<title><%= name %> Demo</title>
8-
<!-- Requires Webcomponents.js polyfill is provided by the page for browsers that don't support html imports -->
9-
<script src="../webcomponentsjs/webcomponents-lite.min.js"></script>
10-
<!-- Import custom element. Note: see comment about relative paths to dependencies in the *.html file referenced below -->
11-
<link rel="import" href="<%= name %>.html"/>
12-
<link rel="import" href="../px-theme/px-theme.html"/>
13-
</head>
144

15-
<body>
5+
<head>
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<title>
9+
<%= name %> Demo</title>
10+
<!-- Requires Webcomponents.js polyfill is provided by the page for browsers that don't support html imports -->
11+
<script src="../webcomponentsjs/webcomponents-lite.min.js"></script>
12+
<!-- Import custom element. Note: see comment about relative paths to dependencies in the *.html file referenced below -->
13+
<link rel="import" href="<%= name %>.html" />
14+
<link rel="import" href="../px-theme/px-theme.html" />
15+
</head>
1616

17-
<h3>Demo</h3>
17+
<body>
1818

19-
<p>
20-
Although related, examples are /not/ the same as the test fixtures.
21-
Tests are tests, examples are examples.
22-
</p>
19+
<h3>Demo</h3>
2320

24-
<p>
25-
Also see the <a href="index.html">documentation</a> and the <a href="test/fixture.html">UI test fixture</a>.
26-
</p>
21+
<<%=name %> counter-value="0"></<%=name %>>
22+
</body>
2723

28-
<p>
29-
Click on the counter to make it increment:
30-
</p>
31-
32-
<!-- instance 1, "predix" theme -->
33-
<<%= name %> counter-value="1">&hearts;</<%= name %>>
34-
</body>
3524
</html>

Diff for: app/templates/src/_component-polymer1.html

+25-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<!--
32
Relative paths assume component is being run from inside an app or another component, where dependencies are flat
43
siblings. When this component is run from its own repo (e.g. ui tests, examples), we assume the server is started with
@@ -24,54 +23,49 @@
2423
@demo demo.html
2524
-->
2625
<dom-module id="<%= name %>">
27-
<link rel="import" type="css" href="css/<%= name %>.css"/>
28-
<template>
29-
<div class="circle counter" on-click="handleClick">
30-
<span>{{counterValue}}</span>
31-
<content></content>
32-
</div>
33-
</template>
26+
<link rel="import" type="css" href="css/<%= name %>.css"/>
27+
<template>
28+
<a on-click="handleClick" href="javascript:;">Click here to increment counter:</a>
29+
<span>{{counterValue}}</span>
30+
</template>
3431
</dom-module>
3532

3633
<script>
37-
Polymer({
38-
39-
is: '<%= name %>',
34+
Polymer({
4035

41-
<% if (mixinNames) {%>
42-
behaviors: [<%= mixinNames.join(',') %>],
43-
<% } %>
36+
is: '<%= name %>', <% if (mixinNames) {%> behaviors: [<%= mixinNames.join(',') %>], <% } %>
4437

45-
/**
46-
* Properties block, expose attribute values to the DOM via 'reflect'
38+
/**
39+
* Properties block, expose attribute values to the DOM via 'notify'
4740
*
4841
* @property properties
4942
* @type Object
5043
*/
51-
properties: {
52-
counterValue: {
53-
type: Number,
54-
reflect: true
55-
}
56-
},
44+
properties: {
45+
counterValue: {
46+
type: Number,
47+
value: 0,
48+
notify: true
49+
}
50+
},
5751

58-
/**
52+
/**
5953
* Handles click on the element defined in 'on-click' on the template
6054
*
6155
* @method handleClick
6256
*/
63-
handleClick: function(event, detail, sender) {
64-
this.increment();
65-
},
57+
handleClick: function(event, detail, sender) {
58+
this.increment();
59+
},
6660

67-
/**
61+
/**
6862
* Increments the counter
6963
*
7064
* @method increment
7165
*/
72-
increment: function () {
73-
this.counterValue++;
74-
}
66+
increment: function() {
67+
this.counterValue++;
68+
}
7569

76-
});
70+
});
7771
</script>

Diff for: app/templates/src/_component-predix.scss

-10
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,3 @@ common/abstract rules go in <%= name %>-sketch.scss, not in this file.
2323
@import "px-colors-design/_settings.colors.scss";
2424

2525
@import '<%= name %>-sketch.scss';
26-
27-
.circle {
28-
border-style: none;
29-
box-shadow: .2rem .2rem .2rem 0 rgba($black,.5);
30-
}
31-
32-
.counter {
33-
background-color: $blue;
34-
color: $white;
35-
}

Diff for: app/templates/src/_component-sketch.scss

-15
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,6 @@ Predix branding rules go in <%= name %>-predix.scss, not in this file.
4646
<% } %>
4747

4848
// Component
49-
.circle {
50-
cursor: pointer;
51-
user-select: none;
52-
box-sizing: content-box; /* Even though we use shadow DOM in this component, Safari insists on bleeding styles through from outside, so reset the resetting of this */
53-
border: 1px black dashed;
54-
font-size: 2rem;
55-
text-align: center;
56-
padding: 1.25rem .4rem .4rem .4rem;
57-
border-radius: 50%;
58-
}
59-
.counter {
60-
display: inline-block;
61-
min-width: 6.5rem;
62-
height: 3rem;
63-
}
6449

6550
// Trumps
6651
@import "inuit-clearfix/_trumps.clearfix.scss";

Diff for: test-gen/templates/custom-test-template.js

+18
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,23 @@ function runCustomTests() {
55
// This is the placeholder suite to place custom tests in
66
// Use testCase(options) for a more convenient setup of the test cases
77
suite('Custom Automation Tests for <%= tagname %>', function() {
8+
test('Check initial value of counter', function(done){
9+
var counterEl = Polymer.dom(document).querySelector('<%= tagname %>'),
10+
counterValueEl = Polymer.dom(counterEl.root).querySelector('span');
11+
assert.equal(counterValueEl.textContent, '0');
12+
done();
13+
});
14+
15+
test('Clicking <%= tagname %> increments the counter', function(done){
16+
var counterEl = Polymer.dom(document).querySelector('<%= tagname %>'),
17+
counterValueEl = Polymer.dom(counterEl.root).querySelector('span');
18+
assert.equal(counterValueEl.textContent, '0');
19+
20+
counterEl.click();
21+
flush(function(){
22+
assert.equal(counterValueEl.textContent, '1');
23+
});
24+
done();
25+
});
826
});
927
};

Diff for: test-gen/templates/wct.conf-template.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
verbose: true,
2+
verbose: false,
33
plugins: {
44
local: {
55
browsers: ['chrome', 'firefox']

Diff for: util/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
{name: "Lists", value: {bowerDev: "\"px-meta-lists-design\": \"https://github.com/PredixDev/px-meta-lists-design.git#~0.3.2\","}},
1010
{name: "Forms", value: {bowerDev: "\"px-forms-design\": \"https://github.com/PredixDev/px-forms-design.git#~0.3.11\","}},
1111
{name: "Headings", value: {bowerDev: "\"px-headings-design\": \"https://github.com/PredixDev/px-headings-design.git#~0.2.10\","}},
12-
{name: "Tables", value: {bowerDev: "\"px-tables-design\": \"https://github.com/PredixDev/px-tables-design.git#~0.3.10\","}}
12+
{name: "Tables", value: {bowerDev: "\"px-tables-design\": \"https://github.com/PredixDev/px-tables-design.git#~0.3.10\","}}
1313
],
1414

1515
dependencyChoicesTest: [

0 commit comments

Comments
 (0)