Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// import { async, ComponentFixture, TestBed } from '@angular/core/testing';
// import { Component, ViewChild } from '@angular/core';
//
// import { DatasetsByProjetComponent } from './output-by-category.component';
// import { Attribute } from '../../../metamodel/model';
// import { ATTRIBUTE_LIST } from '../../../../settings/test-data';
//
// describe('[Search][Output] Component: OutputByCategoryComponent', () => {
// @Component({
// selector: `app-host`,
// template: `
// <app-output-by-category
// [categoryLabel]="categoryLabel"
// [attributeList]="attributeList"
// [outputList]="outputList"
// [isAllSelected]="isAllSelected"
// [isAllUnselected]="isAllUnselected">
// </app-output-by-category>`
// })
// class TestHostComponent {
// @ViewChild(DatasetsByProjetComponent, { static: false })
// public testedComponent: DatasetsByProjetComponent;
// public categoryLabel = 'Default output category';
// public attributeList: Attribute[] = ATTRIBUTE_LIST;
// public outputList: number[] = [1];
// public isAllSelected = true;
// public isAllUnselected: false;
// }
//
// let testHostComponent: TestHostComponent;
// let testHostFixture: ComponentFixture<TestHostComponent>;
// let testedComponent: DatasetsByProjetComponent;
//
// beforeEach(async(() => {
// TestBed.configureTestingModule({
// declarations: [
// DatasetsByProjetComponent,
// TestHostComponent
// ]
// });
// testHostFixture = TestBed.createComponent(TestHostComponent);
// testHostComponent = testHostFixture.componentInstance;
// testHostFixture.detectChanges();
// testedComponent = testHostComponent.testedComponent;
// }));
//
// it('should create the component', () => {
// expect(testedComponent).toBeTruthy();
// });
//
// it('#getAttributeListSortedByDisplay() should sort attributeList by output_display', () => {
// const sortedAttributeList: Attribute[] = testedComponent.getAttributeListSortedByDisplay();
// expect(sortedAttributeList[0].id).toBe(2);
// expect(sortedAttributeList[1].id).toBe(1);
// });
//
// it('#isSelected(idOutput) should return true if output is selected', () => {
// expect(testedComponent.isSelected(1)).toBeTruthy();
// });
//
// it('#isSelected(idOutput) should return false if output is not selected', () => {
// expect(testedComponent.isSelected(2)).toBeFalsy();
// });
//
// it('#toggleSelection(idOutput) should remove idOutput from outputList and raise change event', () => {
// const idOutput = 1;
// const expectedOutputList = [];
// testedComponent.change.subscribe((event: number[]) => expect(event).toEqual(expectedOutputList));
// testedComponent.toggleSelection(idOutput);
// });
//
// it('#toggleSelection(idOutput) should add idOutput to outputList and raise change event', () => {
// const idOutput = 2;
// const expectedOutputList = [1, 2];
// testedComponent.change.subscribe((event: number[]) => expect(event).toEqual(expectedOutputList));
// testedComponent.toggleSelection(idOutput);
// });
//
// it('#selectAll() should add all outputs to outputList and raise change event', () => {
// const expectedOutputList = [1, 2];
// testedComponent.change.subscribe((event: number[]) => expect(event).toEqual(expectedOutputList));
// testedComponent.selectAll();
// });
//
// it('#unselectAll() should remove all outputs to outputList and raise change event', () => {
// const expectedOutputList = [];
// testedComponent.change.subscribe((event: number[]) => expect(event).toEqual(expectedOutputList));
// testedComponent.unselectAll();
// });
// });
//