-
-
Notifications
You must be signed in to change notification settings - Fork 970
Allow option update #1686
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
Draft
davidjbradshaw
wants to merge
12
commits into
dev
Choose a base branch
from
dev-update
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Allow option update #1686
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8ab78f6
Allow option update
davidjbradshaw 6a1a5a0
Add common hasMouseEvents()
davidjbradshaw 1d390bb
inPageLinks off
davidjbradshaw 878d69f
PR feedback
davidjbradshaw 7bb21a6
Fix test
davidjbradshaw 9280af2
Update options on core
davidjbradshaw 233513b
Derive console expand state from log option in wrappers
davidjbradshaw 016bcb2
fix(react): strip logExpand from options passed to connectResizer
Copilot a2b41c9
test(vue): assert consoleGroup.expand receives correct boolean for lo…
Copilot d3036bb
Add consoleGroup.expand assertions to Svelte mounted tests
Copilot fc6c6c0
fix(angular): strip logExpand from options passed to connectResizer
Copilot af4b0db
fix: ESLint formatting in angular directive
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,26 @@ | ||
| import { beforeEach, describe, expect, it, vi } from 'vitest' | ||
|
|
||
| vi.mock('../console', () => ({ advise: vi.fn() })) | ||
|
|
||
| const { advise } = await import('../console') | ||
| const state = (await import('../values/state')).default | ||
| const moveToAnchor = (await import('./move-to-anchor')).default | ||
|
|
||
| describe('child/methods/move-to-anchor', () => { | ||
| beforeEach(() => { | ||
| vi.restoreAllMocks() | ||
| state.inPageLinks = { findTarget: vi.fn() } | ||
| state.findInPageLinkTarget = vi.fn() | ||
| }) | ||
|
|
||
| it('calls findTarget with the provided anchor', () => { | ||
| moveToAnchor('section-1') | ||
| expect(state.inPageLinks.findTarget).toHaveBeenCalledWith('section-1') | ||
| expect(state.findInPageLinkTarget).toHaveBeenCalledWith('section-1') | ||
| }) | ||
|
|
||
| it('throws TypeError when anchor is not a string', () => { | ||
| // @ts-expect-error testing runtime type check with wrong type | ||
| expect(() => moveToAnchor(123)).toThrowError(TypeError) | ||
| }) | ||
|
|
||
| it('advises when inPageLinks is not enabled', () => { | ||
| state.inPageLinks = undefined | ||
| moveToAnchor('section-1') | ||
| expect(advise).toHaveBeenCalledWith(expect.stringContaining('inPageLinks')) | ||
| it('is a no-op when inPageLinks is not enabled', () => { | ||
| state.findInPageLinkTarget = null | ||
| expect(() => moveToAnchor('section-1')).not.toThrow() | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,9 @@ | ||
| import { typeAssert } from '@iframe-resizer/common' | ||
| import { STRING } from '@iframe-resizer/common/consts' | ||
|
|
||
| import { advise } from '../console' | ||
| import state from '../values/state' | ||
|
|
||
| export default function moveToAnchor(anchor: string): void { | ||
| typeAssert(anchor, STRING, 'parentIframe.moveToAnchor(anchor) anchor') | ||
|
|
||
| if (!state.inPageLinks?.findTarget) { | ||
| advise( | ||
| '<rb>Move to Anchor</><br><br>moveToAnchor() requires <b>inPageLinks</> to be enabled', | ||
| ) | ||
| return | ||
| } | ||
|
|
||
| state.inPageLinks.findTarget(anchor) | ||
| state.findInPageLinkTarget?.(anchor) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the latest commit. The ESLint auto-formatter moved the line break before
.optionsto satisfy the formatting rule.