Custom copy clipboard notifications (#8211)

* Initial Commit

* Improve plugin tests

Fixes #8209

* Fix RSOE

* Fix extraneous copy to clipboard at startup
This commit is contained in:
Jeremy Ruston
2024-05-29 15:06:33 +01:00
committed by GitHub
parent 928f3fc413
commit 78fb4a2c1d
7 changed files with 53 additions and 24 deletions

View File

@@ -22,22 +22,30 @@ if($tw.node) {
describe("every plugin should have the required standard fields", function() {
var titles = Object.keys(tiddlers);
$tw.utils.each(titles,function(title) {
it("plugin " + title + " should have the required standard fields",function() {
var fields = tiddlers[title];
expect(fields["plugin-type"]).toMatch(/^(?:plugin|language|theme)$/);
switch(fields["plugin-type"]) {
case "plugin":
expect(!!(fields.name && fields.description && fields.list)).toEqual(true);
expect(fields.stability).toMatch(/^(?:STABILITY_0_DEPRECATED|STABILITY_1_EXPERIMENTAL|STABILITY_2_STABLE|STABILITY_3_LEGACY)$/);
break;
case "language":
expect(!!(fields.name && fields.description)).toEqual(true);
break;
case "theme":
expect(!!(fields.name && fields.description)).toEqual(true);
break;
}
var fields = tiddlers[title];
it("plugin should have a recognised plugin-type field",function() {
expect(["plugin","language","theme"].indexOf(fields["plugin-type"]) !== -1).toEqual(true);
});
switch(fields["plugin-type"]) {
case "plugin":
it("plugin " + title + " should have name, description and list fields",function() {
expect(!!(fields.name && fields.description && fields.list)).toBe(true);
});
it("plugin " + title + " should have a valid stability field",function() {
expect(["STABILITY_0_DEPRECATED","STABILITY_1_EXPERIMENTAL","STABILITY_2_STABLE","STABILITY_3_LEGACY"].indexOf(fields.stability) !== -1).toBe(true);
});
break;
case "language":
it("language " + title + " should have name and description fields",function() {
expect(!!(fields.name && fields.description)).toEqual(true);
});
break;
case "theme":
it("theme " + title + " should have name and description fields",function() {
expect(!!(fields.name && fields.description)).toEqual(true);
});
break;
}
});
});
});