Skip to content

Commit

Permalink
fix: add more significant digits to y-axis
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuss committed Feb 6, 2024
1 parent 88eaa85 commit 77fc683
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ it('draggable annotation rescales axis in positive direction', () => {
cy.get('g.axis.y-axis > g.tick').should('have.length', 17);
cy.get('g.axis.y-axis > g.tick > text')
.eq(16)
.should('have.text', '8.0k');
.should('have.text', '8k');
cy.get('g.axis.y-axis > g.tick > text')
.eq(0)
.should('have.text', '0.0');
.should('have.text', '0');
});

it('draggable annotation rescales axis in negative direction', () => {
Expand All @@ -90,10 +90,10 @@ it('draggable annotation rescales axis in negative direction', () => {
cy.get('g.axis.y-axis > g.tick').should('have.length', 9);
cy.get('g.axis.y-axis > g.tick > text')
.eq(8)
.should('have.text', '3.0k');
.should('have.text', '3k');
cy.get('g.axis.y-axis > g.tick > text')
.eq(0)
.should('have.text', '−5.0k');
.should('have.text', '−5k');
});

it('non-Editable annotation is not draggable', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ it('draggable annotation rescales axis in positive direction', () => {
cy.get('g.axis.y-axis > g.tick').should('have.length', 17);
cy.get('g.axis.y-axis > g.tick > text')
.eq(16)
.should('have.text', '9.0k');
.should('have.text', '9k');
cy.get('g.axis.y-axis > g.tick > text')
.eq(0)
.should('have.text', '1.0k');
.should('have.text', '1k');
});

it('draggable annotation rescales axis in negative direction', () => {
Expand All @@ -240,10 +240,10 @@ it('draggable annotation rescales axis in negative direction', () => {
cy.get('g.axis.y-axis > g.tick').should('have.length', 10);
cy.get('g.axis.y-axis > g.tick > text')
.eq(9)
.should('have.text', '5.0k');
.should('have.text', '5k');
cy.get('g.axis.y-axis > g.tick > text')
.eq(0)
.should('have.text', '−4.0k');
.should('have.text', '−4k');
});

it('non-Editable annotation is not draggable', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ it('draggable annotation rescales axis in positive direction', () => {
cy.get('g.axis.y-axis > g.tick').should('have.length', 17);
cy.get('g.axis.y-axis > g.tick > text')
.eq(16)
.should('have.text', '9.0k');
.should('have.text', '9k');
cy.get('g.axis.y-axis > g.tick > text')
.eq(0)
.should('have.text', '1.0k');
.should('have.text', '1k');
});

it('draggable annotation rescales axis in negative direction', () => {
Expand All @@ -124,10 +124,10 @@ it('draggable annotation rescales axis in negative direction', () => {
cy.get('g.axis.y-axis > g.tick').should('have.length', 10);
cy.get('g.axis.y-axis > g.tick > text')
.eq(9)
.should('have.text', '5.0k');
.should('have.text', '5k');
cy.get('g.axis.y-axis > g.tick > text')
.eq(0)
.should('have.text', '−4.0k');
.should('have.text', '−4k');
});

it('non-Editable annotation is not draggable', () => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/synchro-charts/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { addChartCommands } from './chartCommands';
addChartCommands();

addMatchImageSnapshotCommand({
failureThresholdType: 'pixel',
failureThreshold: 2,
failureThresholdType: 'percent',
failureThreshold: 0.01,
customDiffConfig: { threshold: 0.2 },
});
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const yAxisConstructor = (size: SizeConfig, viewport: ViewPort) => {

return axisLeft(yScale)
.ticks(yTickCount)
.tickFormat(format('.2s'))
.tickFormat(format('.4~s'))
.tickSize(-size.width)
.tickPadding(TICK_PADDING);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ describe('initial render', () => {

it('has expected y axis value labels', async () => {
const { axis } = await axisSpecPage();
expect(axis.innerHTML).toContain('3.0k');
expect(axis.innerHTML).toContain('3k');
expect(axis.innerHTML).toContain('3.05k');
expect(axis.innerHTML).toContain('3.1k');
expect(axis.innerHTML).not.toContain('3.00k');
});

it('renders the y-axis label', async () => {
Expand Down Expand Up @@ -246,9 +246,9 @@ describe('updated correctly', () => {
expect(axis.innerHTML).not.toContain('3.10k');

// Does contain new y labels
expect(axis.innerHTML).toContain('4.0k');
expect(axis.innerHTML).toContain('4k');
expect(axis.innerHTML).toContain('4.5k');
expect(axis.innerHTML).toContain('5.0k');
expect(axis.innerHTML).toContain('5k');
});

it('updates the y-axis label', async () => {
Expand Down

0 comments on commit 77fc683

Please sign in to comment.