Skip to content

Commit cd99292

Browse files
committed
✨ Set contest table as default tab in problems page (#1901)
1 parent 9f34560 commit cd99292

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/lib/stores/active_problem_list_tab.svelte.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
export type ActiveProblemListTab = 'contestTable' | 'listByGrade' | 'gradeGuidelineTable';
22

33
export class ActiveProblemListTabStore {
4-
value = $state<ActiveProblemListTab>('listByGrade');
4+
value = $state<ActiveProblemListTab>('contestTable');
55

66
/**
77
* Creates an instance with the specified problem list tab.
88
*
99
* @param activeTab - The default problem list tab to initialize.
10-
* Defaults to 'listByGrade'.
10+
* Defaults to 'contestTable'.
1111
*/
12-
constructor(activeTab: ActiveProblemListTab = 'listByGrade') {
12+
constructor(activeTab: ActiveProblemListTab = 'contestTable') {
1313
this.value = activeTab;
1414
}
1515

@@ -42,10 +42,10 @@ export class ActiveProblemListTabStore {
4242

4343
/**
4444
* Resets the active tab to the default value.
45-
* Sets the internal value to 'listByGrade'.
45+
* Sets the internal value to 'contestTable'.
4646
*/
4747
reset(): void {
48-
this.value = 'listByGrade';
48+
this.value = 'contestTable';
4949
}
5050
}
5151

src/test/lib/stores/active_problem_list_tab.svelte.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ describe('ActiveProblemListTabStore', () => {
1111

1212
describe('constructor', () => {
1313
test('expects to initialize with default value', () => {
14-
expect(store.get()).toBe('listByGrade');
14+
expect(store.get()).toBe('contestTable');
1515
});
1616

1717
test('expects to initialize with provided value', () => {
18-
const customStore = new ActiveProblemListTabStore('contestTable');
19-
expect(customStore.get()).toBe('contestTable');
18+
const customStore = new ActiveProblemListTabStore('listByGrade');
19+
expect(customStore.get()).toBe('listByGrade');
2020
});
2121
});
2222

2323
describe('get', () => {
2424
test('expects to return the current active tab', () => {
25-
expect(store.get()).toBe('listByGrade');
25+
expect(store.get()).toBe('contestTable');
2626
});
2727
});
2828

2929
describe('set', () => {
3030
test('expects to update the active tab value', () => {
31-
store.set('contestTable');
32-
expect(store.get()).toBe('contestTable');
31+
store.set('listByGrade');
32+
expect(store.get()).toBe('listByGrade');
3333

3434
store.set('gradeGuidelineTable');
3535
expect(store.get()).toBe('gradeGuidelineTable');
@@ -38,24 +38,24 @@ describe('ActiveProblemListTabStore', () => {
3838

3939
describe('isSame', () => {
4040
test('expects to return true when active tab matches the argument', () => {
41-
store.set('contestTable');
42-
expect(store.isSame('contestTable')).toBe(true);
41+
store.set('listByGrade');
42+
expect(store.isSame('listByGrade')).toBe(true);
4343
});
4444

4545
test('expects to return false when active tab does not match the argument', () => {
46-
store.set('contestTable');
47-
expect(store.isSame('listByGrade')).toBe(false);
46+
store.set('listByGrade');
47+
expect(store.isSame('contestTable')).toBe(false);
4848
expect(store.isSame('gradeGuidelineTable')).toBe(false);
4949
});
5050
});
5151

5252
describe('reset', () => {
5353
test('expects to reset the active tab to the default value', () => {
54-
store.set('contestTable');
55-
expect(store.get()).toBe('contestTable');
54+
store.set('listByGrade');
55+
expect(store.get()).toBe('listByGrade');
5656

5757
store.reset();
58-
expect(store.get()).toBe('listByGrade');
58+
expect(store.get()).toBe('contestTable');
5959
});
6060
});
6161
});

0 commit comments

Comments
 (0)