Skip to content

Commit

Permalink
Add new extend linear scale with values up to 10.
Browse files Browse the repository at this point in the history
- This supports some specific estimation cases.
- Rename the previous linear scale.

Signed-off-by: Martin Kilger <martin.kilger@tngtech.com>
  • Loading branch information
mk-tng committed Feb 21, 2025
1 parent 1cd9dbc commit bbd0905
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
15 changes: 11 additions & 4 deletions frontend/src/Components/ScaleSelector/ScaleSelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ describe('The ScaleSelector', () => {
'Fibonacci',
'Cohen',
'Fixed Ratio',
'Linear',
'Linear (0-6)',
'Linear (0-10)',
'Sizes',
]);
expect(getSelectedOptions(dropdown)).toEqual(['Cohen']);
Expand Down Expand Up @@ -123,7 +124,10 @@ describe('The ScaleSelector', () => {
expect(getSelectedOptions(dropdown)).toEqual(['Fixed Ratio']);

fireEvent.keyDown(dropdown, { code: 'ArrowDown' });
expect(getSelectedOptions(dropdown)).toEqual(['Linear']);
expect(getSelectedOptions(dropdown)).toEqual(['Linear (0-6)']);

fireEvent.keyDown(dropdown, { code: 'ArrowDown' });
expect(getSelectedOptions(dropdown)).toEqual(['Linear (0-10)']);

fireEvent.keyDown(dropdown, { code: 'ArrowDown' });
expect(getSelectedOptions(dropdown)).toEqual(['Sizes']);
Expand All @@ -135,7 +139,10 @@ describe('The ScaleSelector', () => {
expect(getSelectedOptions(dropdown)).toEqual(['Sizes']);

fireEvent.keyDown(dropdown, { code: 'ArrowUp' });
expect(getSelectedOptions(dropdown)).toEqual(['Linear']);
expect(getSelectedOptions(dropdown)).toEqual(['Linear (0-10)']);

fireEvent.keyDown(dropdown, { code: 'ArrowUp' });
expect(getSelectedOptions(dropdown)).toEqual(['Linear (0-6)']);

fireEvent.keyDown(dropdown, { code: 'ArrowUp' });
expect(getSelectedOptions(dropdown)).toEqual(['Fixed Ratio']);
Expand Down Expand Up @@ -193,7 +200,7 @@ describe('The ScaleSelector', () => {
expect(getSelectedOptions(dropdown)).toEqual(['Sizes']);

fireEvent.keyDown(dropdown, { code: 'ArrowUp' });
expect(getSelectedOptions(dropdown)).toEqual(['Linear']);
expect(getSelectedOptions(dropdown)).toEqual(['Linear (0-10)']);

fireEvent.mouseMove(getByText('Sizes'));
fireEvent.mouseLeave(getByText('Sizes'));
Expand Down
4 changes: 4 additions & 0 deletions shared/cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const NUMERIC_VALUES_ORDERED = [
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'13',
'16',
'20',
Expand Down
9 changes: 7 additions & 2 deletions shared/scales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type ScaleName =
| 'COHEN_SCALE'
| 'FIXED_RATIO_SCALE'
| 'LINEAR_SCALE'
| 'LINEAR_EXTENDED_SCALE'
| 'SIZES_SCALE';

export const SCALES: { [id in ScaleName]: { name: string; values: CardValue[] } } = {
Expand Down Expand Up @@ -34,8 +35,12 @@ export const SCALES: { [id in ScaleName]: { name: string; values: CardValue[] }
values: ['1', '2', '4', '8', '16', '32', '64', '128', ...SPECIAL_VALUES_ORDERED],
},
LINEAR_SCALE: {
name: 'Linear',
values: ['0', '1', '2', '3', '4', '5', ...SPECIAL_VALUES_ORDERED],
name: 'Linear (0-6)',
values: ['0', '1', '2', '3', '4', '5', '6', ...SPECIAL_VALUES_ORDERED],
},
LINEAR_EXTENDED_SCALE: {
name: 'Linear (0-10)',
values: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', ...SPECIAL_VALUES_ORDERED],
},
SIZES_SCALE: { name: 'Sizes', values: [...SIZES_ORDERED, ...SPECIAL_VALUES_ORDERED] },
};

0 comments on commit bbd0905

Please sign in to comment.