1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { StoryObj } from '@storybook/vue3';
import { HttpResponse, http } from 'msw';
import search_ from './search.vue';
import { userDetailed } from '@/../.storybook/fakes.js';
import { commonHandlers } from '@/../.storybook/mocks.js';
const localUser = userDetailed('someuserid', 'miskist', null, 'Local Misskey User');
export const Default = {
render(args) {
return {
components: {
search_,
},
setup() {
return {
args,
};
},
computed: {
props() {
return {
...this.args,
};
},
},
template: '<search_ v-bind="props" />',
};
},
args: {
ignoreNotesSearchAvailable: true,
},
parameters: {
layout: 'fullscreen',
msw: {
handlers: [
...commonHandlers,
http.post('/api/users/show', () => {
return HttpResponse.json(userDetailed());
}),
http.post('/api/users/search', () => {
return HttpResponse.json([userDetailed(), localUser]);
}),
],
},
},
} satisfies StoryObj<typeof search_>;
export const NoteSearchDisabled = {
...Default,
args: {},
} satisfies StoryObj<typeof search_>;
export const WithUsernameLocal = {
...Default,
args: {
...Default.args,
username: localUser.username,
host: localUser.host,
},
parameters: {
layout: 'fullscreen',
msw: {
handlers: [
...commonHandlers,
http.post('/api/users/show', () => {
return HttpResponse.json(localUser);
}),
http.post('/api/users/search', () => {
return HttpResponse.json([userDetailed(), localUser]);
}),
],
},
},
} satisfies StoryObj<typeof search_>;
export const WithUserType = {
...Default,
args: {
type: 'user',
},
} satisfies StoryObj<typeof search_>;
|