Skip to content

Commit 94e9d64

Browse files
authored
Embedded Single Card: scalar card line chart simplify testing (#6513)
Simplify testing for readability of scalar card line chart testing.
1 parent 0a64553 commit 94e9d64

File tree

1 file changed

+14
-40
lines changed

1 file changed

+14
-40
lines changed

tensorboard/webapp/metrics/views/card_renderer/scalar_card_line_chart_test.ts

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,10 +1379,7 @@ describe('scalar card line chart', () => {
13791379
minStep: 0,
13801380
maxStep: 100,
13811381
};
1382-
const scalarCardComponent = fixture.debugElement.query(
1383-
By.directive(ScalarCardLineChartComponent)
1384-
);
1385-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1382+
fixture.componentInstance.stepOrLinkedTimeSelection = {
13861383
start: {step: 20},
13871384
end: null,
13881385
};
@@ -1425,10 +1422,7 @@ describe('scalar card line chart', () => {
14251422
minStep: 0,
14261423
maxStep: 100,
14271424
};
1428-
const scalarCardComponent = fixture.debugElement.query(
1429-
By.directive(ScalarCardLineChartComponent)
1430-
);
1431-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1425+
fixture.componentInstance.stepOrLinkedTimeSelection = {
14321426
start: {step: 20},
14331427
end: {step: 40},
14341428
};
@@ -1446,10 +1440,7 @@ describe('scalar card line chart', () => {
14461440
minStep: 0,
14471441
maxStep: 100,
14481442
};
1449-
const scalarCardComponent = fixture.debugElement.query(
1450-
By.directive(ScalarCardLineChartComponent)
1451-
);
1452-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1443+
fixture.componentInstance.stepOrLinkedTimeSelection = {
14531444
start: {step: 20},
14541445
end: null,
14551446
};
@@ -1473,7 +1464,7 @@ describe('scalar card line chart', () => {
14731464
testController.mouseMove(fakeEvent);
14741465

14751466
// Simulate ngrx update from mouseMove;
1476-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1467+
fixture.componentInstance.stepOrLinkedTimeSelection = {
14771468
start: {step: 25},
14781469
end: null,
14791470
};
@@ -1495,7 +1486,7 @@ describe('scalar card line chart', () => {
14951486
testController.mouseMove(fakeEvent);
14961487

14971488
// Simulate ngrx update from mouseMove;
1498-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1489+
fixture.componentInstance.stepOrLinkedTimeSelection = {
14991490
start: {step: 30},
15001491
end: null,
15011492
};
@@ -1550,10 +1541,7 @@ describe('scalar card line chart', () => {
15501541
minStep: 0,
15511542
maxStep: 100,
15521543
};
1553-
const scalarCardComponent = fixture.debugElement.query(
1554-
By.directive(ScalarCardLineChartComponent)
1555-
);
1556-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1544+
fixture.componentInstance.stepOrLinkedTimeSelection = {
15571545
start: {step: 20},
15581546
end: null,
15591547
};
@@ -1716,10 +1704,7 @@ describe('scalar card line chart', () => {
17161704

17171705
// Click the prospective fob to set the start time
17181706
testController.prospectiveFobClicked(new MouseEvent('mouseclick'));
1719-
const scalarCardComponent = fixture.debugElement.query(
1720-
By.directive(ScalarCardLineChartComponent)
1721-
);
1722-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1707+
fixture.componentInstance.stepOrLinkedTimeSelection = {
17231708
start: {step: 10},
17241709
end: null,
17251710
};
@@ -1743,7 +1728,7 @@ describe('scalar card line chart', () => {
17431728

17441729
// Click the prospective fob to set the end time
17451730
testController.prospectiveFobClicked(new MouseEvent('mouseclick'));
1746-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1731+
fixture.componentInstance.stepOrLinkedTimeSelection = {
17471732
start: {step: 10},
17481733
end: {step: 25},
17491734
};
@@ -1783,10 +1768,7 @@ describe('scalar card line chart', () => {
17831768
minStep: 10,
17841769
maxStep: 30,
17851770
};
1786-
const scalarCardComponent = fixture.debugElement.query(
1787-
By.directive(ScalarCardLineChartComponent)
1788-
);
1789-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1771+
fixture.componentInstance.stepOrLinkedTimeSelection = {
17901772
start: {step: 20},
17911773
end: null,
17921774
};
@@ -1812,10 +1794,7 @@ describe('scalar card line chart', () => {
18121794
minStep: 10,
18131795
maxStep: 30,
18141796
};
1815-
const scalarCardComponent = fixture.debugElement.query(
1816-
By.directive(ScalarCardLineChartComponent)
1817-
);
1818-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1797+
fixture.componentInstance.stepOrLinkedTimeSelection = {
18191798
start: {step: 20},
18201799
end: null,
18211800
};
@@ -1839,7 +1818,7 @@ describe('scalar card line chart', () => {
18391818
testController.mouseMove(fakeEvent);
18401819

18411820
// Simulate ngrx update from mouseMove;
1842-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1821+
fixture.componentInstance.stepOrLinkedTimeSelection = {
18431822
start: {step: 25},
18441823
end: null,
18451824
};
@@ -1867,9 +1846,7 @@ describe('scalar card line chart', () => {
18671846
})
18681847
);
18691848

1870-
expect(
1871-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection
1872-
).toEqual({
1849+
expect(fixture.componentInstance.stepOrLinkedTimeSelection).toEqual({
18731850
start: {step: 25},
18741851
end: null,
18751852
});
@@ -1883,10 +1860,7 @@ describe('scalar card line chart', () => {
18831860
minStep: 10,
18841861
maxStep: 30,
18851862
};
1886-
const scalarCardComponent = fixture.debugElement.query(
1887-
By.directive(ScalarCardLineChartComponent)
1888-
);
1889-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1863+
fixture.componentInstance.stepOrLinkedTimeSelection = {
18901864
start: {step: 20},
18911865
end: null,
18921866
};
@@ -1910,7 +1884,7 @@ describe('scalar card line chart', () => {
19101884
testController.mouseMove(fakeEvent);
19111885

19121886
// Simulate ngrx update from mouseMove
1913-
scalarCardComponent.componentInstance.stepOrLinkedTimeSelection = {
1887+
fixture.componentInstance.stepOrLinkedTimeSelection = {
19141888
start: {step: 25},
19151889
end: null,
19161890
};

0 commit comments

Comments
 (0)