Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(styled): use StorageEvent constructor #75

Merged
merged 3 commits into from Jun 29, 2022
Merged

Conversation

pnlybubbles
Copy link
Contributor

やったこと

  • document.createEventnew StorageEvent()

snapshotテスト時にdocument.createEventでは以下のエラーがでる

NotSupportedError: The provided event type ("StorageEvent") is invalid

こういうmockすると

const original = document.createEvent
Object.defineProperty(document, 'createEvent', {
  writable: true,
  value: jest.fn().mockImplementation(x => x === 'StorageEvent' ? {} : original(x))

ReactのError: Should not already be workingが出てエラーになる

facebook/react#17355

動作確認環境

チェックリスト

不要なチェック項目は消して構いません

  • 破壊的変更がある場合には、対象のパッケージのメジャーバージョンが上がっていることを確認した
  • 追加したコンポーネントが index.ts から再 export されている

@pnlybubbles pnlybubbles marked this pull request as ready for review June 29, 2022 03:09
@pnlybubbles pnlybubbles merged commit 449cf76 into main Jun 29, 2022
@fsubal fsubal deleted the pnly/fix-storage-event branch June 29, 2022 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant