add auto-highlighting of selected/updated code
This commit is contained in:
@@ -13,10 +13,11 @@ export class ApplicationStub implements IApplication {
|
||||
return this;
|
||||
}
|
||||
public findCategory(categoryId: number): ICategory {
|
||||
throw new Error('Method not implemented.');
|
||||
return this.getAllCategories().find(
|
||||
(category) => category.id === categoryId);
|
||||
}
|
||||
public getRecommendedScripts(): readonly IScript[] {
|
||||
throw new Error('Method not implemented.');
|
||||
throw new Error('Method not implemented: getRecommendedScripts');
|
||||
}
|
||||
public findScript(scriptId: string): IScript {
|
||||
return this.getAllScripts().find((script) => scriptId === script.id);
|
||||
|
||||
@@ -11,6 +11,14 @@ export class CategoryStub extends BaseEntity<number> implements ICategory {
|
||||
constructor(id: number) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public getAllScriptsRecursively(): readonly IScript[] {
|
||||
return [
|
||||
...this.scripts,
|
||||
...this.subCategories.flatMap((c) => c.getAllScriptsRecursively()),
|
||||
];
|
||||
}
|
||||
|
||||
public withScriptIds(...scriptIds: string[]): CategoryStub {
|
||||
for (const scriptId of scriptIds) {
|
||||
this.withScript(new ScriptStub(scriptId));
|
||||
|
||||
8
tests/unit/stubs/SelectedScriptStub.ts
Normal file
8
tests/unit/stubs/SelectedScriptStub.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SelectedScript } from '@/application/State/Selection/SelectedScript';
|
||||
import { ScriptStub } from './ScriptStub';
|
||||
|
||||
export class SelectedScriptStub extends SelectedScript {
|
||||
constructor(id: string, revert = false) {
|
||||
super(new ScriptStub(id), revert);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user