Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 420bd9b

Browse files
authored
Merge pull request GoogleWebComponents#198 from GoogleWebComponents/2.0-preview
2.0-preview
2 parents a0d3b0d + 3e3d7fa commit 420bd9b

File tree

7 files changed

+45
-16
lines changed

7 files changed

+45
-16
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
bower_components
1+
bower_components*
22
node_modules
3+
bower-*

bower.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,27 @@
2323
"google"
2424
],
2525
"dependencies": {
26-
"google-apis": "GoogleWebComponents/google-apis#^1.0.0",
27-
"iron-ajax": "PolymerElements/iron-ajax#^1.0.0",
28-
"polymer": "Polymer/polymer#^1.0.0",
29-
"promise-polyfill": "PolymerLabs/promise-polyfill#^1.0.0"
26+
"google-apis": "GoogleWebComponents/google-apis#1 - 2",
27+
"iron-ajax": "PolymerElements/iron-ajax#1 - 2",
28+
"polymer": "Polymer/polymer#1.9 - 2"
3029
},
3130
"devDependencies": {
32-
"iron-component-page": "PolymerElements/iron-component-page#^1.0.2",
33-
"web-component-tester": "*"
31+
"iron-component-page": "PolymerElements/iron-component-page#1 - 2",
32+
"promise-polyfill": "PolymerLabs/promise-polyfill#1 - 2",
33+
"web-component-tester": "^6.0.0"
34+
},
35+
"variants": {
36+
"1.x": {
37+
"dependencies": {
38+
"google-apis": "GoogleWebComponents/google-apis#^1.0.0",
39+
"iron-ajax": "PolymerElements/iron-ajax#^1.0.0",
40+
"polymer": "Polymer/polymer#^1.0.0",
41+
"promise-polyfill": "PolymerLabs/promise-polyfill#^1.0.0"
42+
},
43+
"devDependencies": {
44+
"iron-component-page": "PolymerElements/iron-component-page#^1.0.2",
45+
"web-component-tester": "*"
46+
}
47+
}
3448
}
3549
}

demo/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>google-chart Demo</title>
77

88
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
9+
<link rel="import" href="../../promise-polyfill/promise-polyfill-lite.html">
910
<link rel="import" href="../google-chart.html">
1011
<style>
1112
code {
@@ -336,7 +337,7 @@ <h2>Chart gallery</h2>
336337
</google-chart>
337338

338339
<p>Here's a organization chart:</p>
339-
340+
340341
<google-chart
341342
id="org-chart",
342343
type="org",

google-chart-loader.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<link rel="import" href="../polymer/polymer.html">
2-
<link rel="import" href="../promise-polyfill/promise-polyfill.html">
32
<link rel="import" href="charts-loader.html">
43

54
<script>

google-chart.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<link rel="import" href="../polymer/polymer.html">
22
<link rel="import" href="../iron-ajax/iron-request.html">
3-
<link rel="import" href="../promise-polyfill/promise-polyfill-lite.html">
43
<link rel="import" href="google-chart-loader.html">
54
<link rel="import" href="google-chart-styles.html">
65

@@ -233,7 +232,7 @@
233232
* undefined}
234233
*/
235234
data: {
236-
type: Object,
235+
type: String,
237236
observer: '_dataChanged'
238237
},
239238

@@ -433,12 +432,25 @@
433432
_dataChanged: function(data) {
434433
var dataPromise;
435434
if (!data) { return; }
436-
if (typeof data == 'string' || data instanceof String) {
435+
436+
var isString = false;
437+
438+
// Polymer 2 will not call observer if type:Object is set and fails, so
439+
// we must parse the string ourselves.
440+
try {
441+
data = JSON.parse(data);
442+
} catch (e) {
443+
isString = typeof data == 'string' || data instanceof String;
444+
}
445+
446+
if (isString) {
437447
// Load data asynchronously, from external URL.
438448
var request = /** @type {!IronRequestElement} */ (document.createElement('iron-request'));
439449
dataPromise = request.send({
440450
url: /** @type string */(data), handleAs: 'json'
441-
}).then(function(xhr) { return xhr.response; });
451+
}).then(function(xhr) {
452+
return xhr.response;
453+
});
442454
} else {
443455
// Data is all ready to be processed.
444456
dataPromise = Promise.resolve(data);

test/basic-tests.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
<!doctype html>
1111
<html>
1212
<head>
13-
<script src="../../webcomponentsjs/webcomponents.min.js"></script>
13+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
1414
<script src="../../web-component-tester/browser.js"></script>
1515

16+
<link rel="import" href="../../promise-polyfill/promise-polyfill-lite.html">
1617
<link rel="import" href="../google-chart.html">
1718
</head>
1819

test/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
1515
<title>Tests</title>
1616

17-
<script src="../../webcomponentsjs/webcomponents.min.js"></script>
17+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
1818
<script src="../../web-component-tester/browser.js"></script>
1919
</head>
2020

2121
<body>
2222
<script>
2323
// Load and run all tests (.html, .js) as one suite:
2424
WCT.loadSuites([
25-
'basic-tests.html'
25+
'basic-tests.html?wc-shadydom=true&wc-ce=true',
26+
'basic-tests.html?dom=shadow'
2627
]);
2728
</script>
2829
</body>

0 commit comments

Comments
 (0)