diff --git a/ng2-components/ng2-alfresco-login/package.json b/ng2-components/ng2-alfresco-login/package.json index 702f832812..af3372db23 100644 --- a/ng2-components/ng2-alfresco-login/package.json +++ b/ng2-components/ng2-alfresco-login/package.json @@ -4,12 +4,13 @@ "version": "0.1.0", "author": "Alfresco Software, Ltd.", "scripts": { - "build": "typings install && tsc", + "build": "tslint -c tslint.json **/*.ts && typings install && tsc && license-check", + "licensecheck": "license-check", "tsc": "tsc", "tsc:w": "tsc -w", "typings": "typings", - "format": "xo", - "test": "live-server --open=tests-runner.html" + "test": "live-server --open=index.html --entry-file=test/ --mount=/ng2-alfresco-core:../ng2-alfresco-core", + "test:w": "concurrently \"npm run tsc:w\" \"npm run test\" " }, "repository": { "type": "git", @@ -42,9 +43,7 @@ "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2", "zone.js": "0.6.10", - "ng2-translate": "^1.11.2", - "angular2": "2.0.0-beta.15", - "ng2-alfresco-core": "0.1.0" + "ng2-translate": "^1.11.2" }, "peerDependencies": { "angular2": "2.0.0-beta.15", @@ -55,28 +54,20 @@ "live-server": "^0.9.2", "typescript": "^1.8.10", "typings": "^0.7.12", - "xo": "^0.14.0" + "license-check": "^1.0.4", + "tslint": "^3.8.1", + "concurrently": "^2.0.0" }, - "xo": { - "overrides": [ - { - "files": "test/*.js", - "rules": { - "max-nested-callbacks": 0, - "handle-callback-err": 0 - } - } + "license-check-config": { + "src": [ + "**/*.ts", + "!/**/*.d.ts", + "!/**/node_modules/**/*", + "!/**/typings/**/*" ], - "rules": { - "no-lonely-if" : 0, - "one-var": 0, - "padded-blocks": 0, - "no-mixed-requires": 0, - "quotes": [ - 2, - "single", - "avoid-escape" - ] - } + "path": "assets/license_header.txt", + "blocking": false, + "logInfo": false, + "logError": true } } diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.d.ts b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.d.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.js b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.js deleted file mode 100644 index 0ec7f0aec5..0000000000 --- a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.js +++ /dev/null @@ -1,294 +0,0 @@ -System.register(['angular2/platform/testing/browser', 'angular2/testing', 'angular2/core', './alfresco-login', 'rxjs/Rx', '../services/alfresco-authentication', 'angular2/src/router/router', 'angular2/router', 'angular2/src/mock/location_mock', 'ng2-translate/ng2-translate'], function(exports_1, context_1) { - "use strict"; - var __moduleName = context_1 && context_1.id; - var browser_1, testing_1, core_1, alfresco_login_1, Rx_1, alfresco_authentication_1, router_1, router_2, location_mock_1, ng2_translate_1; - var AuthenticationMock, TranslationMock; - return { - setters:[ - function (browser_1_1) { - browser_1 = browser_1_1; - }, - function (testing_1_1) { - testing_1 = testing_1_1; - }, - function (core_1_1) { - core_1 = core_1_1; - }, - function (alfresco_login_1_1) { - alfresco_login_1 = alfresco_login_1_1; - }, - function (Rx_1_1) { - Rx_1 = Rx_1_1; - }, - function (alfresco_authentication_1_1) { - alfresco_authentication_1 = alfresco_authentication_1_1; - }, - function (router_1_1) { - router_1 = router_1_1; - }, - function (router_2_1) { - router_2 = router_2_1; - }, - function (location_mock_1_1) { - location_mock_1 = location_mock_1_1; - }, - function (ng2_translate_1_1) { - ng2_translate_1 = ng2_translate_1_1; - }], - execute: function() { - AuthenticationMock = (function () { - function AuthenticationMock() { - this.mockName = 'Mocked Service'; - } - AuthenticationMock.prototype.login = function (method, username, password) { - if (username === 'fake-username' && password === 'fake-password') { - return Rx_1.Observable.of(true); - } - else { - return Rx_1.Observable.throw('Fake server error'); - } - }; - AuthenticationMock.prototype.getProviders = function () { - return [core_1.provide(alfresco_authentication_1.AlfrescoAuthenticationService, { useValue: this })]; - }; - return AuthenticationMock; - }()); - TranslationMock = (function () { - function TranslationMock() { - this.onLangChange = new core_1.EventEmitter(); - } - TranslationMock.prototype.setDefaultLang = function () { - }; - TranslationMock.prototype.use = function () { - }; - TranslationMock.prototype.get = function (key, interpolateParams) { - if (!key) { - throw new Error('Parameter "key" required'); - } - return Rx_1.Observable.of(key); - }; - return TranslationMock; - }()); - testing_1.describe('AlfrescoLogin', function () { - var authService, location, router; - testing_1.setBaseTestProviders(browser_1.TEST_BROWSER_PLATFORM_PROVIDERS, browser_1.TEST_BROWSER_APPLICATION_PROVIDERS); - testing_1.beforeEachProviders(function () { - authService = new AuthenticationMock(); - return [ - authService.getProviders(), - router_2.RouteRegistry, - core_1.provide(router_2.Location, { useClass: location_mock_1.SpyLocation }), - core_1.provide(router_2.ROUTER_PRIMARY_COMPONENT, { useValue: alfresco_login_1.AlfrescoLoginComponent }), - core_1.provide(router_2.Router, { useClass: router_1.RootRouter }), - core_1.provide(ng2_translate_1.TranslateService, { useClass: TranslationMock }) - ]; - }); - testing_1.beforeEach(testing_1.inject([router_2.Router, router_2.Location], function (r, l) { - router = r; - location = l; - })); - testing_1.it('should render `Login` form with all the keys to be translated', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - fixture.detectChanges(); - var element = fixture.nativeElement; - testing_1.expect(element.querySelector('h2').innerText).toEqual('login'); - testing_1.expect(element.querySelector('[for="username"]')).toBeDefined(); - testing_1.expect(element.querySelector('[for="username"]').innerText).toEqual('username'); - testing_1.expect(element.querySelector('#username-error').innerText).toEqual('input-required-message'); - testing_1.expect(element.querySelector('[for="password"]')).toBeDefined(); - testing_1.expect(element.querySelector('[for="password"]').innerText).toEqual('password'); - testing_1.expect(element.querySelector('#password-required').innerText).toEqual('input-required-message'); - }); - })); - testing_1.it('should render user and password input fields with default values', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var element = fixture.nativeElement; - testing_1.expect(element.querySelector('form')).toBeDefined(); - testing_1.expect(element.querySelector('input[type="password"]')).toBeDefined(); - testing_1.expect(element.querySelector('input[type="text"]')).toBeDefined(); - testing_1.expect(element.querySelector('input[type="password"]').value).toEqual(''); - testing_1.expect(element.querySelector('input[type="text"]').value).toEqual(''); - }); - })); - testing_1.it('should render min-length error when the username is lower than 4 characters', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'us'; - fixture.detectChanges(); - component.onValueChanged(); - fixture.detectChanges(); - testing_1.expect(component.formError).toBeDefined(true); - testing_1.expect(component.formError.username).toBeDefined(true); - testing_1.expect(component.formError.username).toEqual('input-min-message'); - testing_1.expect(compiled.querySelector('#username-error').innerText).toEqual('input-min-message'); - }); - })); - testing_1.it('should render no errors when the username and password are correct', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-user'; - component.form.controls.password._value = 'fake-password'; - fixture.detectChanges(); - component.onValueChanged(); - fixture.detectChanges(); - testing_1.expect(component.formError).toBeDefined(true); - testing_1.expect(component.formError.username).toEqual(''); - testing_1.expect(component.formError.password).toEqual(''); - testing_1.expect(compiled.querySelector('#login-error')).toBeNull(); - }); - })); - testing_1.it('should render the new values after user and password values are changed', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'my username'; - component.form.controls.password._value = 'my password'; - fixture.detectChanges(); - testing_1.expect(compiled.querySelector('input[type="password"]').value).toEqual('my password'); - testing_1.expect(compiled.querySelector('input[type="text"]').value).toEqual('my username'); - }); - })); - testing_1.it('should navigate to Home route after the login have succeeded ', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - router.config([new router_2.Route({ path: '/home', name: 'Home', component: alfresco_login_1.AlfrescoLoginComponent })]); - spyOn(router, 'navigate').and.callThrough(); - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-username'; - component.form.controls.password._value = 'fake-password'; - fixture.detectChanges(); - compiled.querySelector('button').click(); - fixture.detectChanges(); - testing_1.expect(component.error).toBe(false); - testing_1.expect(router.navigate).toHaveBeenCalledWith(['Home']); - }); - })); - testing_1.it('should return error with a wrong username ', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - spyOn(router, 'navigate').and.callThrough(); - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-wrong-username'; - component.form.controls.password._value = 'fake-password'; - fixture.detectChanges(); - compiled.querySelector('button').click(); - fixture.detectChanges(); - testing_1.expect(fixture.componentInstance.error).toBe(true); - testing_1.expect(compiled.querySelector('#login-error').innerText).toEqual('login-error-message'); - }); - })); - testing_1.it('should return error with a wrong password ', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - spyOn(router, 'navigate').and.callThrough(); - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-username'; - component.form.controls.password._value = 'fake-wrong-password'; - fixture.detectChanges(); - compiled.querySelector('button').click(); - fixture.detectChanges(); - testing_1.expect(fixture.componentInstance.error).toBe(true); - testing_1.expect(compiled.querySelector('#login-error').innerText).toEqual('login-error-message'); - }); - })); - testing_1.it('should return error with a wrong username and password ', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - spyOn(router, 'navigate').and.callThrough(); - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-wrong-username'; - component.form.controls.password._value = 'fake-wrong-password'; - fixture.detectChanges(); - compiled.querySelector('button').click(); - fixture.detectChanges(); - testing_1.expect(fixture.componentInstance.error).toBe(true); - testing_1.expect(compiled.querySelector('#login-error').innerText).toEqual('login-error-message'); - }); - })); - testing_1.it('should emit onSuccess event after the login has succeeded', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - spyOn(component.onSuccess, 'emit'); - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-username'; - component.form.controls.password._value = 'fake-password'; - fixture.detectChanges(); - component.onValueChanged(); - var nativeElement = fixture.nativeElement; - var button = nativeElement.querySelector('button'); - button.dispatchEvent(new Event('click')); - fixture.detectChanges(); - testing_1.expect(fixture.componentInstance.error).toBe(false); - testing_1.expect(compiled.querySelector('#login-success').innerHTML).toEqual('login-success-message'); - testing_1.expect(component.onSuccess.emit).toHaveBeenCalledWith({ value: 'Login OK' }); - }); - })); - testing_1.it('should emit onError event after the login has failed', testing_1.injectAsync([testing_1.TestComponentBuilder], function (tcb) { - return tcb - .createAsync(alfresco_login_1.AlfrescoLoginComponent) - .then(function (fixture) { - var component = fixture.componentInstance; - component.isErrorStyle = function () { - }; - spyOn(component.onError, 'emit'); - var compiled = fixture.debugElement.nativeElement; - component.form.controls.username._value = 'fake-wrong-username'; - component.form.controls.password._value = 'fake-password'; - fixture.detectChanges(); - component.onValueChanged(); - // trigger the click - var nativeElement = fixture.nativeElement; - var button = nativeElement.querySelector('button'); - button.dispatchEvent(new Event('click')); - fixture.detectChanges(); - testing_1.expect(fixture.componentInstance.error).toBe(true); - testing_1.expect(compiled.querySelector('#login-error').innerText).toEqual('login-error-message'); - testing_1.expect(component.onError.emit).toHaveBeenCalledWith({ value: 'Login KO' }); - }); - })); - }); - } - } -}); -//# sourceMappingURL=alfresco-login.spec.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.js.map b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.js.map deleted file mode 100644 index 18b09eca0c..0000000000 --- a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"alfresco-login.spec.js","sourceRoot":"","sources":["alfresco-login.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA4BA;gBAAA;oBACW,aAAQ,GAAW,gBAAgB,CAAC;gBAa/C,CAAC;gBAXG,kCAAK,GAAL,UAAM,MAAc,EAAE,QAAgB,EAAE,QAAgB;oBACpD,EAAE,CAAC,CAAC,QAAQ,KAAK,eAAe,IAAI,QAAQ,KAAK,eAAe,CAAC,CAAC,CAAC;wBAC/D,MAAM,CAAC,eAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;oBAC/B,CAAC;oBAAC,IAAI,CAAC,CAAC;wBACJ,MAAM,CAAC,eAAU,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;oBACjD,CAAC;gBACL,CAAC;gBAED,yCAAY,GAAZ;oBACI,MAAM,CAAC,CAAC,cAAO,CAAC,uDAA6B,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;gBACtE,CAAC;gBACL,yBAAC;YAAD,CAAC,AAdD,IAcC;YAED;gBAAA;oBAEW,iBAAY,GA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CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACnD,gBAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;wBACxF,gBAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,EAAC,KAAK,EAAE,UAAU,EAAC,CAAC,CAAC;oBAC7E,CAAC,CAAC,CAAC;gBACX,CAAC,CAAC,CAAC,CAAC;YAER,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.d.ts b/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.d.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.js b/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.js deleted file mode 100644 index 22ed32c636..0000000000 --- a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.js +++ /dev/null @@ -1,100 +0,0 @@ -System.register(['angular2/testing', 'angular2/core', 'angular2/http', 'angular2/http/testing', './alfresco-authentication'], function(exports_1, context_1) { - "use strict"; - var __moduleName = context_1 && context_1.id; - var testing_1, core_1, http_1, testing_2, alfresco_authentication_1; - return { - setters:[ - function (testing_1_1) { - testing_1 = testing_1_1; - }, - function (core_1_1) { - core_1 = core_1_1; - }, - function (http_1_1) { - http_1 = http_1_1; - }, - function (testing_2_1) { - testing_2 = testing_2_1; - }, - function (alfresco_authentication_1_1) { - alfresco_authentication_1 = alfresco_authentication_1_1; - }], - execute: function() { - testing_1.describe('AlfrescoAuthentication', function () { - var injector, backend, mockBackend, httpService, service; - beforeEach(function () { - injector = core_1.Injector.resolveAndCreate([ - http_1.HTTP_PROVIDERS, - testing_2.MockBackend, - core_1.provide(http_1.XHRBackend, { useClass: testing_2.MockBackend }), - alfresco_authentication_1.AlfrescoAuthenticationService - ]); - var store = {}; - spyOn(localStorage, 'getItem').and.callFake(function (key) { - return store[key]; - }); - spyOn(localStorage, 'setItem').and.callFake(function (key, value) { - return store[key] = value + ''; - }); - spyOn(localStorage, 'clear').and.callFake(function () { - store = {}; - }); - spyOn(localStorage, 'removeItem').and.callFake(function (key) { - delete store[key]; - }); - spyOn(localStorage, 'key').and.callFake(function (i) { - var keys = Object.keys(store); - return keys[i] || null; - }); - mockBackend = injector.get(testing_2.MockBackend); - backend = injector.get(http_1.XHRBackend); - httpService = injector.get(http_1.Http); - service = injector.get(alfresco_authentication_1.AlfrescoAuthenticationService); - }); - testing_1.it('should return true and token if the user is logged in', function () { - service.saveJwt('fake-local-token'); - expect(service.isLoggedIn()).toBe(true); - expect(localStorage.getItem('token')).toBeDefined(); - expect(localStorage.getItem('token')).toEqual('fake-local-token'); - }); - testing_1.it('should return false and token undefined if the user is not logged in', function () { - expect(service.isLoggedIn()).toEqual(false); - expect(localStorage.getItem('token')).not.toBeDefined(); - }); - testing_1.it('should return true and token on sign in', function () { - backend.connections.subscribe(function (connection) { - connection.mockRespond(new http_1.Response(new http_1.ResponseOptions({ body: { data: { ticket: 'fake-post-token' } } }))); - }); - service.token = ''; - service.login('POST', 'fakeUser', 'fakePassword') - .subscribe(function () { - expect(service.isLoggedIn()).toBe(true); - expect(service.token).toEqual('fake-post-token'); - expect(localStorage.getItem('token')).toBeDefined(); - expect(localStorage.getItem('token')).toEqual('fake-post-token'); - }); - }); - testing_1.it('should return false and token undefined on log out', function () { - service.token = 'fake-token'; - localStorage.setItem('token', 'fake-token'); - service.logout() - .subscribe(function () { - expect(service.isLoggedIn()).toBe(false); - expect(service.token).not.toBeDefined(); - expect(localStorage.getItem('token')).not.toBeDefined(); - }); - }); - testing_1.it('should return no error if method value is GET', function () { - expect(service.login('GET', 'fakeUser', 'fakePassword').hasErrored).toBe(false); - }); - testing_1.it('should return no error if method value is POST', function () { - expect(service.login('POST', 'fakeUser', 'fakePassword').hasErrored).toBe(false); - }); - testing_1.it('should throw an exception if method value is different from GET or POST', function () { - expect(service.login('PUT', 'fakeUser', 'fakePassword').error).toEqual('Invalid method name the value should be GET or POST'); - }); - }); - } - } -}); -//# sourceMappingURL=alfresco-authentication.spec.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.js.map b/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.js.map deleted file mode 100644 index c2615673d8..0000000000 --- a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"alfresco-authentication.spec.js","sourceRoot":"","sources":["alfresco-authentication.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;YAuBA,kBAAQ,CAAC,wBAAwB,EAAE;gBAC/B,IAAI,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,OAAO,CAAC;gBAEZ,UAAU,CAAC;oBACP,QAAQ,GAAG,eAAQ,CAAC,gBAAgB,CAAC;wBACjC,qBAAc;wBACd,qBAAW;wBACX,cAAO,CAAC,iBAAU,EAAE,EAAC,QAAQ,EAAE,qBAAW,EAAC,CAAC;wBAC5C,uDAA6B;qBAChC,CAAC,CAAC;oBAEH,IAAI,KAAK,GAAG,EAAE,CAAC;oBAEf,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,GAAG;wBACrD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBACtB,CAAC,CAAC,CAAC;oBACH,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,GAAG,EAAE,KAAK;wBAC5D,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;oBACnC,CAAC,CAAC,CAAC;oBACH,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,GAA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,CAAC,CAAC;wBACzC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;wBACxC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;oBAC5D,CAAC,CACJ,CAAC;gBACN,CAAC,CAAC,CAAC;gBAEH,YAAE,CAAC,+CAA+C,EAAE;oBAChD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACpF,CAAC,CAAC,CAAC;gBAEH,YAAE,CAAC,gDAAgD,EAAE;oBACjD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrF,CAAC,CAAC,CAAC;gBAEH,YAAE,CAAC,yEAAyE,EAAE;oBAC1E,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,qDAAqD,CAAC,CAAC;gBAClI,CAAC,CAAC,CAAC;YAEP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/test/.gitignore b/ng2-components/ng2-alfresco-login/test/.gitignore new file mode 100644 index 0000000000..75871e6dc2 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/test/.gitignore @@ -0,0 +1,3 @@ +*.js +*.js.map +*.d.ts diff --git a/ng2-components/ng2-alfresco-login/test/assets/authentication.service.mock.ts b/ng2-components/ng2-alfresco-login/test/assets/authentication.service.mock.ts new file mode 100644 index 0000000000..f216d93cf9 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/test/assets/authentication.service.mock.ts @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Observable} from 'rxjs/Observable'; +import {provide} from 'angular2/core'; + +import {AlfrescoAuthenticationService} from '../../src/services/alfresco-authentication'; + +export class AuthenticationMock { + login(method: string, username: string, password: string) { + if (username === 'fake-username' && password === 'fake-password') { + return Observable.of(true); + } else { + return Observable.throw('Fake server error'); + } + } + + getProviders(): Array { + return [provide(AlfrescoAuthenticationService, {useValue: this})]; + } +} diff --git a/ng2-components/ng2-alfresco-login/test/assets/translation.service.mock.ts b/ng2-components/ng2-alfresco-login/test/assets/translation.service.mock.ts new file mode 100644 index 0000000000..35ada2db31 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/test/assets/translation.service.mock.ts @@ -0,0 +1,40 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Observable} from 'rxjs/Observable'; +import {provide, EventEmitter} from 'angular2/core'; +import {LangChangeEvent} from 'ng2-translate/ng2-translate'; + + +export class TranslationMock { + + public onLangChange: EventEmitter = new EventEmitter(); + + setDefaultLang() { + + } + + use() { + } + + public get(key: string|Array, interpolateParams?: Object): Observable { + if (!key) { + throw new Error('Parameter "key" required'); + } + return Observable.of(key); + } +} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.ts b/ng2-components/ng2-alfresco-login/test/components/alfresco-login.spec.ts similarity index 91% rename from ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.ts rename to ng2-components/ng2-alfresco-login/test/components/alfresco-login.spec.ts index bf2c1e2a2d..c55364532c 100644 --- a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.spec.ts +++ b/ng2-components/ng2-alfresco-login/test/components/alfresco-login.spec.ts @@ -17,49 +17,15 @@ import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from 'angular2/platform/testing/browser'; import {it, describe, expect, inject, injectAsync, beforeEach, beforeEachProviders, TestComponentBuilder, setBaseTestProviders} from 'angular2/testing'; import {Component, provide, Injector, EventEmitter} from 'angular2/core'; -import {AlfrescoLoginComponent} from './alfresco-login'; +import {Location, Router, RouteRegistry, ROUTER_PRIMARY_COMPONENT, Route} from 'angular2/router'; +import {RootRouter} from 'angular2/src/router/router'; import {Observable} from 'rxjs/Rx'; -import {AlfrescoAuthenticationService} from '../services/alfresco-authentication'; -import { RootRouter } from 'angular2/src/router/router'; -import { Location, Router, RouteRegistry, ROUTER_PRIMARY_COMPONENT, Route } from 'angular2/router'; -import { SpyLocation } from 'angular2/src/mock/location_mock'; +import {SpyLocation} from 'angular2/src/mock/location_mock'; import {dispatchEvent} from 'angular2/src/testing/utils'; import {TranslateService, LangChangeEvent} from 'ng2-translate/ng2-translate'; - -class AuthenticationMock { - public mockName: string = 'Mocked Service'; - - login(method: string, username: string, password: string) { - if (username === 'fake-username' && password === 'fake-password') { - return Observable.of(true); - } else { - return Observable.throw('Fake server error'); - } - } - - getProviders(): Array { - return [provide(AlfrescoAuthenticationService, {useValue: this})]; - } -} - -class TranslationMock { - - public onLangChange: EventEmitter = new EventEmitter(); - - setDefaultLang() { - - } - - use() { - } - - public get(key: string|Array, interpolateParams?: Object): Observable { - if (!key) { - throw new Error('Parameter "key" required'); - } - return Observable.of(key); - } -} +import {AlfrescoLoginComponent} from '../../src/components/alfresco-login'; +import {AuthenticationMock} from '../assets/authentication.service.mock'; +import {TranslationMock} from '../assets/translation.service.mock'; describe('AlfrescoLogin', () => { let authService, location, router; diff --git a/ng2-components/ng2-alfresco-login/test/index.html b/ng2-components/ng2-alfresco-login/test/index.html new file mode 100644 index 0000000000..6960ea6e65 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/test/index.html @@ -0,0 +1,65 @@ + + + + + + Alfresco Login component Tests + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.ts b/ng2-components/ng2-alfresco-login/test/services/alfresco-authentication.spec.ts similarity index 97% rename from ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.ts rename to ng2-components/ng2-alfresco-login/test/services/alfresco-authentication.spec.ts index 3c2f00e607..5054717dbc 100644 --- a/ng2-components/ng2-alfresco-login/src/services/alfresco-authentication.spec.ts +++ b/ng2-components/ng2-alfresco-login/test/services/alfresco-authentication.spec.ts @@ -18,7 +18,7 @@ import {it, describe} from 'angular2/testing'; import {provide, Injector} from 'angular2/core'; import {Http, HTTP_PROVIDERS, XHRBackend, Response, ResponseOptions} from 'angular2/http'; import {MockBackend} from 'angular2/http/testing'; -import {AlfrescoAuthenticationService} from './alfresco-authentication'; +import {AlfrescoAuthenticationService} from '../../src/services/alfresco-authentication'; describe('AlfrescoAuthentication', () => { diff --git a/ng2-components/ng2-alfresco-login/test/tsconfig.json b/ng2-components/ng2-alfresco-login/test/tsconfig.json new file mode 100644 index 0000000000..9f1af2fc60 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/test/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": false, + "noImplicitAny": false, + "declaration": false + }, + "exclude": [ + ] +} diff --git a/ng2-components/ng2-alfresco-login/tests-runner.html b/ng2-components/ng2-alfresco-login/tests-runner.html deleted file mode 100644 index 220b73a633..0000000000 --- a/ng2-components/ng2-alfresco-login/tests-runner.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Alfresco Login component Tests - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/tsconfig.json b/ng2-components/ng2-alfresco-login/tsconfig.json index 7cb24b5cb9..dfa6d35f88 100644 --- a/ng2-components/ng2-alfresco-login/tsconfig.json +++ b/ng2-components/ng2-alfresco-login/tsconfig.json @@ -14,9 +14,9 @@ "node_modules/angular2/typings/browser.d.ts", "typings/browser/ambient/jasmine/index.d.ts", "src/components/alfresco-login.ts", - "src/components/alfresco-login.spec.ts", + "test/components/alfresco-login.spec.ts", "src/services/alfresco-authentication.ts", - "src/services/alfresco-authentication.spec.ts" + "test/services/alfresco-authentication.spec.ts" ], "exclude": [ "**/node_modules",