This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4026ca9
Showing
14 changed files
with
353 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,27 @@ | ||
{ | ||
"name": "fd-polymer-api-settings", | ||
"version": "0.1.0", | ||
"keywords": [ | ||
"freedomotic", | ||
"seed", | ||
"polymer", | ||
"web-components" | ||
], | ||
"main": "fd-polymer-api-settings.html", | ||
"dependencies": { | ||
"polymer": "Polymer/polymer#^0.4.0", | ||
"core-localstorage": "polymer/core-localstorage#~0.4.2" | ||
}, | ||
"devDependencies": { | ||
"polymer-test-tools": "Polymer/polymer-test-tools#^0.4.0" | ||
}, | ||
"_release": "0.1.0", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "0.1.0", | ||
"commit": "3444f52a332de9b11463146c9fb95ceceb1be5ae" | ||
}, | ||
"_source": "file:///home/matteo/development/components/fd-polymer-api-settings/.git/", | ||
"_target": "*", | ||
"_originalSource": "file:///home/matteo/development/components/fd-polymer-api-settings/.git/" | ||
} |
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,3 @@ | ||
{ | ||
"directory": "../" | ||
} |
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,21 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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 @@ | ||
* text=auto |
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,4 @@ | ||
node_modules | ||
dist | ||
.sass-cache | ||
.tmp |
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,28 @@ | ||
{ | ||
"node": true, | ||
"browser": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"camelcase": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"indent": 2, | ||
"latedef": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"quotmark": "single", | ||
"regexp": true, | ||
"undef": true, | ||
"unused": true, | ||
"strict": true, | ||
"trailing": true, | ||
"smarttabs": true, | ||
"jquery": true, | ||
"globals": { | ||
"wrap": true, | ||
"unwrap": true, | ||
"Polymer": true, | ||
"Platform": true | ||
} | ||
} |
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,8 @@ | ||
fd-polymer-api-settings | ||
================ | ||
|
||
See the [component page](http://freedomotic.github.io/fd-polymer-api-settings) for more information. | ||
|
||
## Getting Started | ||
|
||
We've put together a [guide for fd-polymer-api-settings](http://www.polymer-project.org/docs/start/reusableelements.html) to help get you rolling. |
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,18 @@ | ||
{ | ||
"name": "fd-polymer-api-settings", | ||
"version": "0.1.0", | ||
"keywords": [ | ||
"freedomotic", | ||
"seed", | ||
"polymer", | ||
"web-components" | ||
], | ||
"main": "fd-polymer-api-settings.html", | ||
"dependencies": { | ||
"polymer": "Polymer/polymer#^0.4.0", | ||
"core-localstorage": "polymer/core-localstorage#~0.4.2" | ||
}, | ||
"devDependencies": { | ||
"polymer-test-tools": "Polymer/polymer-test-tools#^0.4.0" | ||
} | ||
} |
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,15 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
<title>fd-polymer-api-settings Demo</title> | ||
|
||
<script src="../platform/platform.js"></script> | ||
<link rel="import" href="fd-polymer-api-settings.html"> | ||
|
||
</head> | ||
<body unresolved> | ||
|
||
<p>An `fd-polymer-api-settings` doesn't look in any way..</p> | ||
</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,127 @@ | ||
<link rel="import" href="../polymer/polymer.html"> | ||
<link rel="import" href="../core-localstorage/core-localstorage.html"> | ||
|
||
<!-- | ||
Element providing DAO for API settings | ||
##### Example | ||
<fd-api-settings></fd-api-settings> | ||
@element fd-api-settings | ||
@blurb Element providing DAO for API settings | ||
@status alpha | ||
@homepage http://polymerlabs.github.io/fd-polymer-api-settings | ||
--> | ||
<polymer-element name="fd-api-settings" attributes="address ssl apiVersion credentialRequired ssl port apiUrl"> | ||
|
||
<template> | ||
<style> | ||
</style> | ||
<core-localstorage | ||
name="ssl" | ||
value="{{ssl}}"> | ||
</core-localstorage> | ||
|
||
<core-localstorage | ||
name="address" | ||
value="{{address}}"> | ||
</core-localstorage> | ||
|
||
<core-localstorage | ||
name="port" | ||
value="{{port}}"> | ||
</core-localstorage> | ||
|
||
<core-localstorage | ||
name="apiVersion" | ||
value="{{apiVersion}}"> | ||
</core-localstorage> | ||
|
||
<core-localstorage | ||
name="credentialrequired" | ||
value="{{credentialRequired}}"> | ||
</core-localstorage> | ||
|
||
<core-localstorage | ||
name="apiurl" | ||
value="{{apiUrl}}"> | ||
</core-localstorage> | ||
</template> | ||
|
||
<script> | ||
|
||
Polymer("fd-api-settings",{ | ||
/** | ||
* The 'credentialRequired' attribute tells whether the API call requires authentication | ||
* | ||
* @attribute credentialRequired | ||
* @type boolean | ||
*/ | ||
|
||
credentialRequired: false, | ||
|
||
/** | ||
* The 'address' attribute specifies the hostname or ip address of API service | ||
* | ||
* @attribute address | ||
* @type string | ||
*/ | ||
|
||
address: "localhost", | ||
|
||
/** | ||
* The 'apiVersion' attribute specifies the API version to use | ||
* | ||
* @attribute apiVersion | ||
* @type string | ||
*/ | ||
apiVersion: "v3", | ||
|
||
/** | ||
* The 'port' attribute specifies the tcp port of API service. | ||
* Default value 0 mean the port number is choosen from the SSL attribute, | ||
* so port will be 9111 if no SSL, and 9113 is SSL | ||
* @attribute port | ||
* @type int | ||
*/ | ||
port: 0, | ||
|
||
/** | ||
* The 'ssl' attribute tells whether the API call requires a encrypted connection | ||
* | ||
* @attribute ssl | ||
* @type boolean | ||
*/ | ||
ssl: false, | ||
|
||
/** | ||
* The 'apiUrl' attribute represents the generated URL through which the dependent services can reach the API | ||
* | ||
* @attribute apiUrl | ||
* @type string | ||
*/ | ||
apiUrl: undefined, | ||
|
||
observe: { | ||
"ssl address port apiVersion": "reloadUrl" | ||
}, | ||
|
||
reloadUrl: function(){ | ||
if(this.ssl != undefined && !!this.apiVersion && !!this.address){ | ||
if (!this.port){ | ||
if (this.ssl){ | ||
this.port=9113; | ||
} else { | ||
this.port=9111; | ||
} | ||
} | ||
this.apiUrl= (this.ssl ? "https" : "http") +"://"+ this.address + ":" + this.port +"/"+ this.apiVersion + "/"; | ||
} | ||
console.log("API:" + this.apiUrl); | ||
} | ||
}); | ||
|
||
</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,15 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
<script src="../platform/platform.js"></script> | ||
<link rel="import" href="../polymer/polymer.html"> | ||
<link rel="import" href="../core-component-page/core-component-page.html"> | ||
|
||
</head> | ||
<body unresolved> | ||
|
||
<core-component-page></core-component-page> | ||
|
||
</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,45 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
<title>fd-polymer-api-settings</title> | ||
|
||
<script src="../../platform/platform.js"></script> | ||
<link rel="import" href="../../polymer-test-tools/tools.html"> | ||
<script src="../../polymer-test-tools/htmltest.js"></script> | ||
|
||
<!-- Step 1: import the element to test --> | ||
<link rel="import" href="../fd-polymer-api-settings.html"> | ||
|
||
</head> | ||
<body> | ||
|
||
<fd-polymer-api-settings></fd-polymer-api-settings> | ||
|
||
<script> | ||
|
||
document.addEventListener('polymer-ready', function() { | ||
// Test a property | ||
var myEl = document.querySelector('fd-polymer-api-settings'); | ||
assert.equal(myEl.author, 'Dimitri Glazkov'); | ||
|
||
// Test a method | ||
var hello = myEl.sayHello(); | ||
assert.equal(hello, 'fd-polymer-api-settings says, Hello World!'); | ||
var greetings = myEl.sayHello('greetings Earthlings'); | ||
assert.equal(greetings, 'fd-polymer-api-settings says, greetings Earthlings'); | ||
|
||
// Test an event | ||
myEl.addEventListener('fd-polymer-api-settings-lasers-success', function(event) { | ||
assert.equal(event.detail.sound, 'Pew pew pew!'); | ||
// IMPORTANT: | ||
// Make sure to call done() at the end of every test suite! | ||
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,21 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> | ||
<title>Core Elements Test Runner</title> | ||
<meta charset="UTF-8"> | ||
|
||
<script src="../../platform/platform.js"></script> | ||
|
||
<link rel="import" href="tests.html"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<div id="mocha"></div> | ||
|
||
</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,20 @@ | ||
<link rel="import" href="../../polymer-test-tools/tools.html"> | ||
|
||
<script src="../../polymer-test-tools/mocha-htmltest.js"></script> | ||
|
||
<script> | ||
|
||
mocha.setup({ui: 'tdd', slow: 1000, timeout: 5000, htmlbase: ''}); | ||
|
||
// Below is a set of sample element test suites. | ||
// Replace these with your own suites of tests. | ||
|
||
htmlSuite('fd-polymer-api-settings', function() { | ||
htmlTest('fd-polymer-api-settings-basic.html'); | ||
}); | ||
|
||
// End sample test suites | ||
|
||
mocha.run(); | ||
|
||
</script> |