Skip to content

Commit

Permalink
Merge pull request #1169 from pjkaufman/master
Browse files Browse the repository at this point in the history
Fix: Live Preview Editor Updates
  • Loading branch information
pjkaufman authored Sep 16, 2024
2 parents 07e1ea4 + 9e1f4a8 commit cc23589
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 147 deletions.
36 changes: 36 additions & 0 deletions __integration__/obsidian-mode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ function edgeCaseSetup(plugin: TestLinterPlugin, _: Editor): Promise<void> {
return;
}

function moveToYamlSetup(plugin: TestLinterPlugin, _: Editor): Promise<void> {
plugin.plugin.settings.ruleConfigs['move-tags-to-yaml'] = {
'enabled': true,
'how-to-handle-existing-tags': 'Remove whole tag',
'tags-to-ignore': '',
};

return;
}

export const obsidianModeTestCases: IntegrationTestCase[] = [
{
name: 'Updating YAML in live preview mode does not break YAML and keeps cursor at the expected location',
Expand Down Expand Up @@ -115,4 +125,30 @@ export const obsidianModeTestCases: IntegrationTestCase[] = [
setup: edgeCaseSetup,
modifyExpected: edgeCaseExpectedTextModifications,
},
{
name: 'Moving tag to YAML when just the tag is present works in live preview mode',
filePath: 'obsidian-mode/move-tag-to-yaml.md',
async setup(plugin: TestLinterPlugin, editor: Editor) {
await moveToYamlSetup(plugin, editor),
await setWorkspaceItemMode(plugin.app, false);
},
},
{
name: 'Moving tag to YAML when just the tag is present works in source mode',
filePath: 'obsidian-mode/move-tag-to-yaml.md',
setup: moveToYamlSetup,
},
{
name: 'Moving tag to YAML when some text and then a tag is present works in live preview mode',
filePath: 'obsidian-mode/move-tag-to-yaml-2.md',
async setup(plugin: TestLinterPlugin, editor: Editor) {
await moveToYamlSetup(plugin, editor),
await setWorkspaceItemMode(plugin.app, false);
},
},
{
name: 'Moving tag to YAML when some text and then a tag is present works in source mode',
filePath: 'obsidian-mode/move-tag-to-yaml-2.md',
setup: moveToYamlSetup,
},
];
90 changes: 23 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@babel/plugin-transform-private-methods": "^7.23.3",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.18.6",
"@codemirror/view": "^6.33.0",
"@jest/types": "^29.5.0",
"@types/async-lock": "^1.4.2",
"@types/diff": "^5.0.9",
Expand Down
Loading

0 comments on commit cc23589

Please sign in to comment.