From 67e9cf7486b19ba86c41a601bf9a55778ca835af Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 5 May 2016 12:53:38 +0100 Subject: [PATCH] Setup unit testing for document list - initial structure and npm commands refs #9 --- .../ng2-alfresco-documentlist/package.json | 13 +++-- .../test/components/document-list.spec.d.ts | 0 .../test/components/document-list.spec.js | 37 +++++++++++++ .../test/components/document-list.spec.js.map | 1 + .../test/components/document-list.spec.ts | 28 ++++++++++ .../ng2-alfresco-documentlist/test/index.html | 52 +++++++++++++++++++ 6 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.d.ts create mode 100644 ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js create mode 100644 ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js.map create mode 100644 ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.ts create mode 100644 ng2-components/ng2-alfresco-documentlist/test/index.html diff --git a/ng2-components/ng2-alfresco-documentlist/package.json b/ng2-components/ng2-alfresco-documentlist/package.json index 97ea7f26dd..84f785b0f4 100644 --- a/ng2-components/ng2-alfresco-documentlist/package.json +++ b/ng2-components/ng2-alfresco-documentlist/package.json @@ -7,7 +7,9 @@ "build": "typings install && tsc", "tsc": "tsc", "tsc:w": "tsc -w", - "typings": "typings" + "typings": "typings", + "test": "live-server --open=test/index.html --mount=/ng2-alfresco-core:../ng2-alfresco-core", + "test:w": "concurrently \"npm run tsc:w\" \"npm run test\" " }, "repository": { "type": "git", @@ -38,11 +40,14 @@ "zone.js": "0.6.10" }, "peerDependencies": { - "angular2": "2.0.0-beta.15", - "ng2-alfresco-core": "0.1.0" + "angular2": "2.0.0-beta.15" }, "devDependencies": { "typescript": "^1.8.10", - "typings": "^0.7.12" + "typings": "^0.7.12", + "jasmine-core": "2.4.1", + "xo": "^0.14.0", + "live-server": "^0.9.2", + "concurrently": "^2.0.0" } } diff --git a/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.d.ts b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js new file mode 100644 index 0000000000..4e04557f4a --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js @@ -0,0 +1,37 @@ +/** + * @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. + */ +System.register(['../../src/components/document-list'], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var document_list_1; + return { + setters:[ + function (document_list_1_1) { + document_list_1 = document_list_1_1; + }], + execute: function() { + describe('document-list', function () { + it('should setup default columns', function () { + var list = new document_list_1.DocumentList(null); + list.ngAfterContentInit(); + expect(list.columns.length).not.toBe(0); + }); + }); + } + } +}); +//# sourceMappingURL=document-list.spec.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js.map b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js.map new file mode 100644 index 0000000000..e1725abf26 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"document-list.spec.js","sourceRoot":"","sources":["document-list.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;YAIH,QAAQ,CAAC,eAAe,EAAE;gBAEtB,EAAE,CAAC,8BAA8B,EAAE;oBAC/B,IAAI,IAAI,GAAiB,IAAI,4BAAY,CAAC,IAAI,CAAC,CAAC;oBAChD,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAC1B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC5C,CAAC,CAAC,CAAC;YAEP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.ts new file mode 100644 index 0000000000..b9647f556b --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/test/components/document-list.spec.ts @@ -0,0 +1,28 @@ +/** + * @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 {DocumentList} from '../../src/components/document-list'; + +describe('document-list', () => { + + it('should setup default columns', () => { + let list: DocumentList = new DocumentList(null); + list.ngAfterContentInit(); + expect(list.columns.length).not.toBe(0); + }); + +}); diff --git a/ng2-components/ng2-alfresco-documentlist/test/index.html b/ng2-components/ng2-alfresco-documentlist/test/index.html new file mode 100644 index 0000000000..1253de03ff --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/test/index.html @@ -0,0 +1,52 @@ + + + + + + Document List Tests + + + + + + + + + + + + + + + + + + + + + + + +