mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-03 01:08:15 +09:00
fix(frontend): fix Chromatic test fails (#13826)
* fix: attempt to fix Chromatic test fails * chore: add comment
This commit is contained in:
parent
9b0fc31751
commit
def7b8c55e
@ -276,8 +276,11 @@ const align = () => {
|
|||||||
const onOpened = () => {
|
const onOpened = () => {
|
||||||
emit('opened');
|
emit('opened');
|
||||||
|
|
||||||
|
// NOTE: Chromatic テストの際に undefined になる場合がある
|
||||||
|
if (content.value == null) return;
|
||||||
|
|
||||||
// モーダルコンテンツにマウスボタンが押され、コンテンツ外でマウスボタンが離されたときにモーダルバックグラウンドクリックと判定させないためにマウスイベントを監視しフラグ管理する
|
// モーダルコンテンツにマウスボタンが押され、コンテンツ外でマウスボタンが離されたときにモーダルバックグラウンドクリックと判定させないためにマウスイベントを監視しフラグ管理する
|
||||||
const el = content.value!.children[0];
|
const el = content.value.children[0];
|
||||||
el.addEventListener('mousedown', ev => {
|
el.addEventListener('mousedown', ev => {
|
||||||
contentClicking = true;
|
contentClicking = true;
|
||||||
window.addEventListener('mouseup', ev => {
|
window.addEventListener('mouseup', ev => {
|
||||||
|
@ -11,6 +11,10 @@ import { i18n } from '@/i18n.js';
|
|||||||
|
|
||||||
let lock: Promise<undefined> | undefined;
|
let lock: Promise<undefined> | undefined;
|
||||||
|
|
||||||
|
function sleep(ms: number) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
const common = {
|
const common = {
|
||||||
render(args) {
|
render(args) {
|
||||||
return {
|
return {
|
||||||
@ -43,6 +47,8 @@ const common = {
|
|||||||
lock = new Promise(r => resolve = r);
|
lock = new Promise(r => resolve = r);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// NOTE: sleep しないと何故か落ちる
|
||||||
|
await sleep(100);
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
const a = canvas.getByRole<HTMLAnchorElement>('link');
|
const a = canvas.getByRole<HTMLAnchorElement>('link');
|
||||||
// await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
// await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
||||||
@ -53,7 +59,7 @@ const common = {
|
|||||||
const i = buttons[0];
|
const i = buttons[0];
|
||||||
await expect(i).toBeInTheDocument();
|
await expect(i).toBeInTheDocument();
|
||||||
await userEvent.click(i);
|
await userEvent.click(i);
|
||||||
// await expect(canvasElement).toHaveTextContent(i18n.ts._ad.back);
|
await expect(canvasElement).toHaveTextContent(i18n.ts._ad.back);
|
||||||
await expect(a).not.toBeInTheDocument();
|
await expect(a).not.toBeInTheDocument();
|
||||||
await expect(i).not.toBeInTheDocument();
|
await expect(i).not.toBeInTheDocument();
|
||||||
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||||
|
Loading…
Reference in New Issue
Block a user