From 7a4753d1d7b7b3b36694aede6631b43448c12793 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Fri, 15 Apr 2016 09:35:19 +0100 Subject: [PATCH] Basic Alfresco login webcomponent tests --- .../alfresco-login/alfresco-login.html | 21 +++-- .../webcomponents/alfresco-login/bower.json | 32 ++++++++ .../webcomponents/alfresco-login/index.html | 2 +- .../alfresco-login/test/index.html | 79 +++++++++++++++++++ 4 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 demo-shell-ng2/webcomponents/alfresco-login/bower.json create mode 100644 demo-shell-ng2/webcomponents/alfresco-login/test/index.html diff --git a/demo-shell-ng2/webcomponents/alfresco-login/alfresco-login.html b/demo-shell-ng2/webcomponents/alfresco-login/alfresco-login.html index 2e230716af..b29138c0b1 100755 --- a/demo-shell-ng2/webcomponents/alfresco-login/alfresco-login.html +++ b/demo-shell-ng2/webcomponents/alfresco-login/alfresco-login.html @@ -1,4 +1,4 @@ - + - - + + @@ -72,13 +72,20 @@ Example: ready: function(){ }, + fireSubmit: function(token) { + this.fire("submit", {ticket: token}); + }, + /** * Login Alfesco * * @param {object} */ - _submit: function() { - event.preventDefault(); + _submit: function(event) { + if(event) { + event.preventDefault(); + } + var self = this; @@ -103,6 +110,7 @@ Example: } xhr.onload = function(e) { + e.preventDefault(); if (xhr.status === 200) { var token = ''; if (xhr.responseXML) { @@ -111,7 +119,7 @@ Example: token = JSON.parse(xhr.responseText).data.ticket; } if (token) { - self.fire("submit", {ticket: token}); + self.fireSubmit(token); } else { self.fire("error", {error:'Token error'}); } @@ -120,6 +128,7 @@ Example: } }; xhr.send(parameterJson); + return xhr; } }); diff --git a/demo-shell-ng2/webcomponents/alfresco-login/bower.json b/demo-shell-ng2/webcomponents/alfresco-login/bower.json new file mode 100644 index 0000000000..3af12e9304 --- /dev/null +++ b/demo-shell-ng2/webcomponents/alfresco-login/bower.json @@ -0,0 +1,32 @@ +{ + "name": "alfresco-login", + "description": "Provide the Alfresco login .", + "keywords": [ + "web-component", + "web-components", + "polymer", + "alfresco" + ], + "main": "alfresco-login.html", + "license": "MIT", + "ignore": [ + "/.*", + "/test/", + "/demo/", + "/bower_components/" + ], + "dependencies": { + "polymer": "Polymer/polymer#^1.0.0", + "paper-input": "~1.1.10" + }, + "devDependencies": { + "iron-component-page": "polymerelements/iron-component-page#^1.0.0", + "iron-image": "polymerelements/iron-image#^1.0.0", + "paper-styles": "polymerelements/paper-styles#^1.0.0", + "test-fixture": "polymerelements/test-fixture#^1.0.0", + "web-component-tester": "^4.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + }, + "_originalSource": "alfresco-login", + "_direct": true +} diff --git a/demo-shell-ng2/webcomponents/alfresco-login/index.html b/demo-shell-ng2/webcomponents/alfresco-login/index.html index 1859d04779..567c389730 100755 --- a/demo-shell-ng2/webcomponents/alfresco-login/index.html +++ b/demo-shell-ng2/webcomponents/alfresco-login/index.html @@ -5,7 +5,7 @@ - + diff --git a/demo-shell-ng2/webcomponents/alfresco-login/test/index.html b/demo-shell-ng2/webcomponents/alfresco-login/test/index.html new file mode 100644 index 0000000000..8561a93bca --- /dev/null +++ b/demo-shell-ng2/webcomponents/alfresco-login/test/index.html @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file