From 11081744ad45cddf0900c5c86d75fbccef0474f8 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Tue, 10 May 2016 09:13:16 -0300 Subject: [PATCH] refactoring main block --- src/app/layout/blocks/main-block/index.ts | 2 -- src/app/layout/blocks/main-block/main-block.component.spec.ts | 40 ---------------------------------------- src/app/layout/blocks/main-block/main-block.component.ts | 10 ---------- src/app/layout/blocks/main-block/main-block.html | 1 - src/app/layout/blocks/main/index.ts | 2 ++ src/app/layout/blocks/main/main-block.component.spec.ts | 40 ++++++++++++++++++++++++++++++++++++++++ src/app/layout/blocks/main/main-block.component.ts | 10 ++++++++++ src/app/layout/blocks/main/main-block.html | 1 + src/app/main/main.component.ts | 2 +- 9 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 src/app/layout/blocks/main-block/index.ts delete mode 100644 src/app/layout/blocks/main-block/main-block.component.spec.ts delete mode 100644 src/app/layout/blocks/main-block/main-block.component.ts delete mode 100644 src/app/layout/blocks/main-block/main-block.html create mode 100644 src/app/layout/blocks/main/index.ts create mode 100644 src/app/layout/blocks/main/main-block.component.spec.ts create mode 100644 src/app/layout/blocks/main/main-block.component.ts create mode 100644 src/app/layout/blocks/main/main-block.html diff --git a/src/app/layout/blocks/main-block/index.ts b/src/app/layout/blocks/main-block/index.ts deleted file mode 100644 index 6a2e3e1..0000000 --- a/src/app/layout/blocks/main-block/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -/* Module Index Entry - generated using the script npm run generate-index */ -export * from "./main-block.component"; diff --git a/src/app/layout/blocks/main-block/main-block.component.spec.ts b/src/app/layout/blocks/main-block/main-block.component.spec.ts deleted file mode 100644 index fd47bec..0000000 --- a/src/app/layout/blocks/main-block/main-block.component.spec.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder'; -import {Input, provide, Component, StateConfig} from 'ng-forward'; - -import {MainBlockComponent} from './main-block.component'; -import {NoosferoApp} from '../../../index.module'; - -const tcb = new TestComponentBuilder(); - -const htmlTemplate: string = ''; - -describe("Components", () => { - describe("Main Block Component", () => { - - // the karma preprocessor html2js transform the templates html into js files which put - // the templates to the templateCache into the module templates - // we need to load the module templates here as the template for the - // component Block will be load on our tests - beforeEach(angular.mock.module("templates")); - - it("check if the main block has a tag with ui-view attribute", done => { - - // Creating a container component (BlockContainerComponent) to include - // the component under test (Block) - @Component({ selector: 'test-container-component', template: htmlTemplate, directives: [MainBlockComponent] }) - class BlockContainerComponent { - } - - // uses the TestComponentBuilder instance to initialize the component - tcb.createAsync(BlockContainerComponent).then(fixture => { - // and here we can inspect and run the test assertions - // let myComponent: MainBlockComponent = fixture.componentInstance; - - // assure the block object inside the Block matches - // the provided through the parent component - expect(fixture.debugElement.queryAll('[ui-view="mainBlockContent"]').length).toEqual(1); - done(); - }); - }); - }); -}); \ No newline at end of file diff --git a/src/app/layout/blocks/main-block/main-block.component.ts b/src/app/layout/blocks/main-block/main-block.component.ts deleted file mode 100644 index 391d3a2..0000000 --- a/src/app/layout/blocks/main-block/main-block.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {Component, Input} from 'ng-forward'; -import {BlockComponent} from '../block.component'; - -@Component({ - selector: 'noosfero-main-block', - templateUrl: 'app/layout/blocks/main-block/main-block.html' -}) -export class MainBlockComponent { - -} diff --git a/src/app/layout/blocks/main-block/main-block.html b/src/app/layout/blocks/main-block/main-block.html deleted file mode 100644 index 129d0a2..0000000 --- a/src/app/layout/blocks/main-block/main-block.html +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/src/app/layout/blocks/main/index.ts b/src/app/layout/blocks/main/index.ts new file mode 100644 index 0000000..6a2e3e1 --- /dev/null +++ b/src/app/layout/blocks/main/index.ts @@ -0,0 +1,2 @@ +/* Module Index Entry - generated using the script npm run generate-index */ +export * from "./main-block.component"; diff --git a/src/app/layout/blocks/main/main-block.component.spec.ts b/src/app/layout/blocks/main/main-block.component.spec.ts new file mode 100644 index 0000000..fd47bec --- /dev/null +++ b/src/app/layout/blocks/main/main-block.component.spec.ts @@ -0,0 +1,40 @@ +import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder'; +import {Input, provide, Component, StateConfig} from 'ng-forward'; + +import {MainBlockComponent} from './main-block.component'; +import {NoosferoApp} from '../../../index.module'; + +const tcb = new TestComponentBuilder(); + +const htmlTemplate: string = ''; + +describe("Components", () => { + describe("Main Block Component", () => { + + // the karma preprocessor html2js transform the templates html into js files which put + // the templates to the templateCache into the module templates + // we need to load the module templates here as the template for the + // component Block will be load on our tests + beforeEach(angular.mock.module("templates")); + + it("check if the main block has a tag with ui-view attribute", done => { + + // Creating a container component (BlockContainerComponent) to include + // the component under test (Block) + @Component({ selector: 'test-container-component', template: htmlTemplate, directives: [MainBlockComponent] }) + class BlockContainerComponent { + } + + // uses the TestComponentBuilder instance to initialize the component + tcb.createAsync(BlockContainerComponent).then(fixture => { + // and here we can inspect and run the test assertions + // let myComponent: MainBlockComponent = fixture.componentInstance; + + // assure the block object inside the Block matches + // the provided through the parent component + expect(fixture.debugElement.queryAll('[ui-view="mainBlockContent"]').length).toEqual(1); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/src/app/layout/blocks/main/main-block.component.ts b/src/app/layout/blocks/main/main-block.component.ts new file mode 100644 index 0000000..fa97a25 --- /dev/null +++ b/src/app/layout/blocks/main/main-block.component.ts @@ -0,0 +1,10 @@ +import {Component, Input} from 'ng-forward'; +import {BlockComponent} from '../block.component'; + +@Component({ + selector: 'noosfero-main-block', + templateUrl: 'app/layout/blocks/main/main-block.html' +}) +export class MainBlockComponent { + +} diff --git a/src/app/layout/blocks/main/main-block.html b/src/app/layout/blocks/main/main-block.html new file mode 100644 index 0000000..129d0a2 --- /dev/null +++ b/src/app/layout/blocks/main/main-block.html @@ -0,0 +1 @@ +
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 6b97764..a9de3c5 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -31,7 +31,7 @@ import {Navbar} from "../layout/navbar/navbar"; import {SidebarComponent} from "../layout/sidebar/sidebar.component"; -import {MainBlockComponent} from "../layout/blocks/main-block/main-block.component"; +import {MainBlockComponent} from "../layout/blocks/main/main-block.component"; import {HtmlEditorComponent} from "../shared/components/html-editor/html-editor.component"; -- libgit2 0.21.2