Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed reported bug about console errors #2095

Merged
merged 7 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fixed hover die template error where width and height were NaN",
"packageName": "@ni/nimble-components",
"email": "33986780+munteannatan@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ export class Computations {
gridDimensions,
containerDiameter
);
const dieWidth = this.horizontalScale.bandwidth();
const dieHeight = this.verticalScale.bandwidth();
this._dieDimensions = {
width: this.horizontalScale.bandwidth(),
height: this.verticalScale.bandwidth()
width: isNaN(dieWidth) ? 0 : dieWidth,
height: isNaN(dieHeight) ? 0 : dieHeight
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export class WorkerRenderer {
}

public renderHover(): void {
if (
this.wafermap.experimentalDataManager.dieDimensions === undefined
|| this.wafermap.transform === undefined
) {
return;
}
this.wafermap.hoverWidth = this.wafermap.experimentalDataManager.dieDimensions.width
* this.wafermap.transform.k;
this.wafermap.hoverHeight = this.wafermap.experimentalDataManager.dieDimensions.height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export class RenderingModule {
}

public renderHover(): void {
if (
this.wafermap.dataManager.dieDimensions === undefined
|| this.wafermap.transform === undefined
) {
return;
}
this.wafermap.hoverWidth = this.wafermap.dataManager.dieDimensions.width
* this.wafermap.transform.k;
this.wafermap.hoverHeight = this.wafermap.dataManager.dieDimensions.height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('WaferMap', () => {
);
});

describe('update flow', () => {
describe('update action', () => {
let spy: jasmine.Spy;
beforeEach(() => {
spy = spyOn(element, 'update');
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('WaferMap', () => {
});
});

describe('worker renderer draw flow', () => {
describe('worker renderer draw action', () => {
let setupWaferSpy: jasmine.Spy;
let drawWaferSpy: jasmine.Spy;
beforeEach(() => {
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('WaferMap', () => {
});
});

describe('worker renderer flow', () => {
describe('worker renderer action', () => {
let renderHoverSpy: jasmine.Spy;
let experimentalUpdateSpy: jasmine.Spy;

Expand Down Expand Up @@ -194,7 +194,7 @@ describe('WaferMap', () => {
});
});

describe('zoom flow', () => {
describe('zoom action', () => {
let initialValue: string | undefined;

beforeEach(() => {
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('WaferMap', () => {
return element.transform.toString();
}

describe('hover flow', () => {
describe('hover action', () => {
beforeEach(async () => {
element.canvasWidth = 500;
element.canvasHeight = 500;
Expand Down Expand Up @@ -321,4 +321,17 @@ describe('WaferMap', () => {
expect(element.hoverTransform).not.toEqual(initialTransform);
});
});

describe('hover action with no canvas dimensions', () => {
beforeEach(async () => {
element.dies = [{ x: 1, y: 1, value: '1' }];
element.colorScale = { colors: ['red', 'red'], values: ['1', '1'] };
await waitForUpdatesAsync();
});

it('will have hover rectangle with no dimensions', () => {
expect(element.hoverHeight).toEqual(0);
expect(element.hoverWidth).toEqual(0);
});
});
});
Loading