generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #966 from pjkaufman/custom-commands-cache-wait
Custom Commands: Wait for Cache for Lint on File Change and Lint on Save
- Loading branch information
Showing
8 changed files
with
288 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import dedent from 'ts-dedent'; | ||
import TestLinterPlugin, {IntegrationTestCase} from './main.test'; | ||
import {Editor} from 'obsidian'; | ||
import expect from 'expect'; | ||
|
||
export const customCommandTestCases: IntegrationTestCase[] = [ | ||
{ | ||
name: 'Advanced Tables custom command running after the linting of a file should run just fine even though it relies on the cache', | ||
filePath: 'custom-commands/table-format.md', | ||
async setup(plugin: TestLinterPlugin, _: Editor) { | ||
plugin.plugin.settings.ruleConfigs['consecutive-blank-lines'] = { | ||
'enabled': true, | ||
}; | ||
|
||
plugin.plugin.settings.lintCommands = [{ | ||
'id': 'table-editor-obsidian:format-all-tables', | ||
'name': 'Format all tables in this file', | ||
}]; | ||
}, | ||
async assertions(editor: Editor) { | ||
expect(editor.getValue()).toBe(dedent` | ||
| one | two | three | four | | ||
| ----- | --- | ----- | ------------- | | ||
| 1 | ✓ | | | | ||
| 2 | | ✓ | | | ||
| 3 | | ✓ | ✓ | | ||
| 4 | … | | someting else | | ||
| Total | 100 | 20 | 300000000 | | ||
${''} | ||
| one | two | three | four | | ||
| ----- | --- | ----- | ------------- | | ||
| 1 | ✓ | | | | ||
| 2 | | ✓ | | | ||
| 3 | | ✓ | ✓ | | ||
| 4 | … | | someting else | | ||
| Total | 100 | 20 | 300000000 | | ||
${''} | ||
| one | two | three | four | | ||
| ----- | --- | ----- | ------------- | | ||
| 1 | ✓ | | | | ||
| 2 | | ✓ | | | ||
| 3 | | ✓ | ✓ | | ||
| 4 | … | | someting else | | ||
| Total | 100 | 20 | 300000000 | | ||
${''} | ||
`); | ||
}, | ||
}, | ||
]; |
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
Oops, something went wrong.