-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Refactor note embedding to be extensible * Prepare new setting to replace preview.embedNoteInContainer * Fix wikilink-embed e2e tests * Improve readability * Set embedNoteInContainer to null in e2e tests to more closely mimic live state
- Loading branch information
Showing
4 changed files
with
178 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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 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
32 changes: 32 additions & 0 deletions
32
packages/foam-vscode/src/features/preview/wikilink-embed.test.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { retrieveNoteConfig } from './wikilink-embed'; | ||
import * as config from '../../services/config'; | ||
|
||
describe('Wikilink Note Embedding', () => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
describe('Config Parsing', () => { | ||
it('should use preview.embedNoteType if deprecated preview.embedNoteInContainer not used', () => { | ||
jest | ||
.spyOn(config, 'getFoamVsCodeConfig') | ||
.mockReturnValueOnce('full-card') | ||
.mockReturnValueOnce(false); | ||
|
||
const { noteScope, noteStyle } = retrieveNoteConfig(); | ||
expect(noteScope).toEqual('full'); | ||
expect(noteStyle).toEqual('card'); | ||
}); | ||
|
||
it('should use preview.embedNoteInContainer if set', () => { | ||
jest | ||
.spyOn(config, 'getFoamVsCodeConfig') | ||
.mockReturnValueOnce('full-inline') | ||
.mockReturnValueOnce(true); | ||
|
||
const { noteScope, noteStyle } = retrieveNoteConfig(); | ||
expect(noteScope).toEqual('full'); | ||
expect(noteStyle).toEqual('card'); | ||
}); | ||
}); | ||
}); |
This file contains 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