Subtypes: add another test.

This commit is contained in:
Daniel J. Geiger 2023-04-28 13:03:03 -05:00
parent ab3467973f
commit 63698572db
4 changed files with 104 additions and 30 deletions

View file

@ -16,8 +16,10 @@ import util from "util";
import path from "path";
import { getMimeType } from "../../data/blob";
import {
SubtypeLoadedCb,
SubtypePrepFn,
SubtypeRecord,
checkRefreshOnSubtypeLoad,
prepareSubtype,
selectSubtype,
subtypeActionPredicate,
@ -45,7 +47,12 @@ export class API {
}
static addSubtype = (record: SubtypeRecord, subtypePrepFn: SubtypePrepFn) => {
const prep = prepareSubtype(record, subtypePrepFn);
const subtypeLoadedCb: SubtypeLoadedCb = (hasSubtype) => {
if (checkRefreshOnSubtypeLoad(hasSubtype, h.elements)) {
h.app.refresh();
}
};
const prep = prepareSubtype(record, subtypePrepFn, subtypeLoadedCb);
if (prep.actions) {
h.app.actionManager.registerAll(prep.actions);
}