mirror of
https://github.com/mnaoumov/obsidian-smart-rename.git
synced 2026-07-22 07:40:32 +00:00
feat: register the open demo vault command
Add OpenDemoVaultCommandHandler (87.0.3 pluginId/pluginVersion signature) so the plugin exposes the "Open demo vault" command; assert it is registered in the plugin test.
This commit is contained in:
parent
9c268b6869
commit
1edec0bc7d
2 changed files with 16 additions and 0 deletions
|
|
@ -77,6 +77,15 @@ describe('Plugin', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should register the open demo vault command via its command handler', async () => {
|
||||
const plugin = new Plugin(createApp(), createManifest());
|
||||
const addCommandSpy = vi.spyOn(plugin, 'addCommand');
|
||||
await plugin.onload();
|
||||
expect(addCommandSpy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ id: 'open-demo-vault' })
|
||||
);
|
||||
});
|
||||
|
||||
it('should add the plugin settings tab via its child component', async () => {
|
||||
const plugin = new Plugin(createApp(), createManifest());
|
||||
const addSettingTabSpy = vi.spyOn(plugin, 'addSettingTab');
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { OpenDemoVaultCommandHandler } from 'obsidian-dev-utils/obsidian/command-handlers/open-demo-vault-command-handler';
|
||||
import { PluginSettingsTabComponent } from 'obsidian-dev-utils/obsidian/components/plugin-settings-tab-component';
|
||||
import { PluginDataHandler } from 'obsidian-dev-utils/obsidian/data-handler';
|
||||
import { PluginBase } from 'obsidian-dev-utils/obsidian/plugin/plugin';
|
||||
|
|
@ -39,6 +40,12 @@ export class Plugin extends PluginBase {
|
|||
new InvokeCommandHandler({
|
||||
pluginSettingsComponent,
|
||||
smartRenameComponent
|
||||
}),
|
||||
new OpenDemoVaultCommandHandler({
|
||||
app: this.app,
|
||||
pluginId: this.manifest.id,
|
||||
pluginNoticeComponent: this.pluginNoticeComponent,
|
||||
pluginVersion: this.manifest.version
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue