Commit c73e431e4f3816def6c743bf2ef259810d85138a
1 parent
9b3a27c9
Exists in
master
and in
26 other branches
adding basic information of statisticst block
Showing
5 changed files
with
68 additions
and
0 deletions
Show diff stats
src/app/layout/blocks/statistics/statistics-block.component.spec.ts
0 → 100644
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder'; | |
| 2 | +import {Component} from 'ng-forward'; | |
| 3 | + | |
| 4 | +import {StatisticsBlockComponent} from './statistics-block.component'; | |
| 5 | + | |
| 6 | +const tcb = new TestComponentBuilder(); | |
| 7 | + | |
| 8 | +const htmlTemplate: string = '<noosfero-statistics-block [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-statistics-block>'; | |
| 9 | + | |
| 10 | +describe("Components", () => { | |
| 11 | + | |
| 12 | + describe("Statistics Block Component", () => { | |
| 13 | + | |
| 14 | + beforeEach(angular.mock.module("templates")); | |
| 15 | + beforeEach(angular.mock.module("ngSanitize")); | |
| 16 | + | |
| 17 | + it("display title stored in block attribute", done => { | |
| 18 | + | |
| 19 | + @Component({ | |
| 20 | + selector: 'test-container-component', | |
| 21 | + template: htmlTemplate, | |
| 22 | + directives: [StatisticsBlockComponent], | |
| 23 | + }) | |
| 24 | + class CustomBlockType { | |
| 25 | + block: any = { settings: { user_counter: '<em>block content</em>' } }; | |
| 26 | + owner: any = { name: 'profile-name' }; | |
| 27 | + } | |
| 28 | + tcb.createAsync(CustomBlockType).then(fixture => { | |
| 29 | + expect(fixture.debugElement.query(".statistics-block").text().trim()).toEqual('block content'); | |
| 30 | + done(); | |
| 31 | + }); | |
| 32 | + }); | |
| 33 | + | |
| 34 | + }); | |
| 35 | + | |
| 36 | +}); | ... | ... |
src/app/layout/blocks/statistics/statistics-block.component.ts
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +import {Component, Input} from "ng-forward"; | |
| 2 | + | |
| 3 | +@Component({ | |
| 4 | + selector: "noosfero-statistics-block", | |
| 5 | + templateUrl: 'app/layout/blocks/statistics/statistics-block.html' | |
| 6 | +}) | |
| 7 | + | |
| 8 | +export class StatisticsBlockComponent { | |
| 9 | + | |
| 10 | + @Input() block: any; | |
| 11 | + @Input() owner: any; | |
| 12 | + | |
| 13 | + html: string; | |
| 14 | + | |
| 15 | + ngOnInit() { | |
| 16 | + this.html = this.block.settings.user_counter; | |
| 17 | + } | |
| 18 | +} | ... | ... |
src/app/main/main.component.ts
| ... | ... | @@ -14,9 +14,12 @@ import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list-blo |
| 14 | 14 | import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents-block.component"; |
| 15 | 15 | import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; |
| 16 | 16 | import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; |
| 17 | +import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; | |
| 17 | 18 | |
| 18 | 19 | import {MembersBlockComponent} from "./../layout/blocks/members/members-block.component"; |
| 19 | 20 | import {CommunitiesBlockComponent} from "./../layout/blocks/communities/communities-block.component"; |
| 21 | + | |
| 22 | + | |
| 20 | 23 | import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; |
| 21 | 24 | import {DateFormat} from "../shared/pipes/date-format.filter"; |
| 22 | 25 | |
| ... | ... | @@ -92,9 +95,16 @@ export class EnvironmentContent { |
| 92 | 95 | ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, |
| 93 | 96 | EnvironmentComponent, PeopleBlockComponent, |
| 94 | 97 | LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent, |
| 98 | +<<<<<<< HEAD | |
| 95 | 99 | MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent, |
| 96 | 100 | MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent |
| 97 | 101 | ].concat(plugins.mainComponents).concat(plugins.hotspots), |
| 102 | +======= | |
| 103 | + MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent, | |
| 104 | + MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, | |
| 105 | + StatisticsBlockComponent | |
| 106 | + ], | |
| 107 | +>>>>>>> adding basic information of statisticst block | |
| 98 | 108 | providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] |
| 99 | 109 | }) |
| 100 | 110 | @StateConfig([ | ... | ... |