Skip to content

Commit

Permalink
Fix tests broken by merging the experimental branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpmishkin committed Oct 26, 2017
1 parent c5e685e commit 205bc80
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ describe('ValueChartDirective', () => {
TestBed.resetTestingModule();

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -240,8 +241,9 @@ describe('ValueChartDirective', () => {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
viewOrientation: ChartOrientation.Vertical,
displayWeightDistributions: false,
displayScoreFunctions: false,
displayTotalScores: false,
displayScales: false,
Expand Down Expand Up @@ -311,7 +313,8 @@ describe('ValueChartDirective', () => {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -363,8 +366,9 @@ describe('ValueChartDirective', () => {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
viewOrientation: ChartOrientation.Vertical,
displayWeightDistributions: false,
displayScoreFunctions: false,
displayTotalScores: false,
displayScales: false,
Expand Down Expand Up @@ -654,8 +658,9 @@ describe('ValueChartDirective', () => {

it('should re-render the valueChart in the new view orientation', () => {
viewerStub.viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
viewOrientation: ChartOrientation.Vertical,
displayWeightDistributions: false,
displayScoreFunctions: true,
displayTotalScores: false,
displayScales: true,
Expand Down Expand Up @@ -765,7 +770,7 @@ describe('ValueChartDirective', () => {

// Check score function updates:
u.valueChart.getAllPrimitiveObjectives().forEach((objective) => {
let scoreFunctionRenderer: ScoreFunctionRenderer = labelRenderer.labelSelections[objective.getId()].renderer;
let scoreFunctionRenderer: ScoreFunctionRenderer = labelRenderer.labelSelections[objective.getId() + '-scorefunction'].renderer;

expect(scoreFunctionRenderer.lastRendererUpdate).to.deep.equal(scoreFunctionRenderer.adjustScoreFunctionInteraction.lastRendererUpdate);
expect(scoreFunctionRenderer.lastRendererUpdate).to.deep.equal(scoreFunctionRenderer.expandScoreFunctionInteraction.lastRendererUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('ReorderObjectivesInteraction', () => {

viewConfig = {
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand All @@ -86,6 +87,7 @@ describe('ReorderObjectivesInteraction', () => {

u = {
el: null,
reducedInformation: false,
valueChart: hotelChart,
usersToDisplay: hotelChart.getUsers(),
viewConfig: viewConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ describe('ResizeWeightsInteraction', () => {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
viewOrientation: ChartOrientation.Vertical,
displayWeightDistributions: false,
displayScoreFunctions: false,
displayTotalScores: false,
displayScales: false,
Expand All @@ -99,6 +100,7 @@ describe('ResizeWeightsInteraction', () => {
el: null,
valueChart: hotelChart,
usersToDisplay: hotelChart.getUsers(),
reducedInformation: false,
viewConfig: viewConfig,
interactionConfig: interactionConfig,
renderRequired: { value: false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ describe('SortAlternativesInteraction', () => {
rowData: null,
labelData: null,
rendererConfig: null,
structuralUpdate: null
structuralUpdate: null,
reducedInformation: false
}

u = rendererDataUtility.produceMaximumWeightMap(u);
Expand Down
6 changes: 4 additions & 2 deletions test/client/unit/ValueChart/renderers/Label.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ var chartUndoRedoStub = {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -215,7 +216,8 @@ var chartUndoRedoStub = {
rowData: null,
labelData: null,
rendererConfig: null,
structuralUpdate: null
structuralUpdate: null,
reducedInformation: false
}

aaron = hotelChart.getUsers()[0];
Expand Down
6 changes: 4 additions & 2 deletions test/client/unit/ValueChart/renderers/ObjectiveChart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ var renderEventsServiceStub = {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -161,7 +162,8 @@ var renderEventsServiceStub = {
rowData: null,
labelData: null,
rendererConfig: null,
structuralUpdate: null
structuralUpdate: null,
reducedInformation: false
}

aaron = hotelChart.getUsers()[0];
Expand Down
6 changes: 4 additions & 2 deletions test/client/unit/ValueChart/renderers/SummaryChart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ var renderEventsServiceStub = {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -160,7 +161,8 @@ var renderEventsServiceStub = {
rowData: null,
labelData: null,
rendererConfig: null,
structuralUpdate: null
structuralUpdate: null,
reducedInformation: false
}

aaron = hotelChart.getUsers()[0];
Expand Down
13 changes: 7 additions & 6 deletions test/client/unit/ValueChart/services/ChangeDetection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('ChangeDetectionService', () => {

viewConfig = {
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand All @@ -72,7 +73,7 @@ describe('ChangeDetectionService', () => {
height = 10;
width = 10;

changeDetectionService.startChangeDetection(hotelChart, width, height, viewConfig, interactionConfig, usersToDisplay);
changeDetectionService.startChangeDetection(hotelChart, width, height, viewConfig, interactionConfig, false, usersToDisplay);
});


Expand Down Expand Up @@ -161,23 +162,23 @@ describe('ChangeDetectionService', () => {
var area = hotelChart.getAllPrimitiveObjectives()[0].getId();
expect(hotelChart.getUsers()[0].getWeightMap().getObjectiveWeight(area)).to.equal(0.2);
hotelChart.getUsers()[0].getWeightMap().setObjectiveWeight(area, 0.3);
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false)).to.be.true;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false, false)).to.be.true;
});

it('should return true when the "renderRequired" parameter is true', () => {
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false)).to.be.false;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, true)).to.be.true;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false, false)).to.be.false;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false, true)).to.be.true;
});

context('when the view orientation and or score function display settings have been changed', () => {
it('should detect the changes in view orientation', () => {
viewConfig.viewOrientation = ChartOrientation.Horizontal;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false)).to.be.true;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false, false)).to.be.true;
});

it('should detect the changes in score function display', () => {
viewConfig.displayScoreFunctions = true;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false)).to.be.true;
expect(changeDetectionService.detectChanges(hotelChart, viewConfig, interactionConfig, false, false)).to.be.true;
});
});
});
Expand Down
6 changes: 4 additions & 2 deletions test/client/unit/ValueChart/utilities/RendererConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ describe('RendererConfigUtility', () => {
rendererConfigUtility = TestBed.get(RendererConfigUtility);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -65,7 +66,8 @@ describe('RendererConfigUtility', () => {
rowData: null,
labelData: null,
rendererConfig: null,
structuralUpdate: null
structuralUpdate: null,
reducedInformation: false
}

u.maximumWeightMap['weightTotal'] = 1;
Expand Down
6 changes: 4 additions & 2 deletions test/client/unit/ValueChart/utilities/RendererData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ describe('RendererDataUtility', () => {
hotelChart = parser.parseValueChart(valueChartDocument);

viewConfig = {
scaleAlternatives: false,
scaleAlternatives: false,
displayWeightDistributions: false,
viewOrientation: ChartOrientation.Vertical,
displayScoreFunctions: false,
displayTotalScores: false,
Expand Down Expand Up @@ -93,7 +94,8 @@ describe('RendererDataUtility', () => {
rowData: null,
labelData: null,
rendererConfig: null,
structuralUpdate: null
structuralUpdate: null,
reducedInformation: false
}

aaron = hotelChart.getUsers()[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ describe('RendererScoreFunctionUtility', () => {
var elements: (string | number)[];

before(function() {
TestBed.resetTestingModule();

TestBed.configureTestingModule({
providers: [ RendererScoreFunctionUtility ]
});
Expand Down

0 comments on commit 205bc80

Please sign in to comment.