1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-07-04 19:12:51 +00:00

add default and custom class to testcase-widget

This commit is contained in:
pmario 2024-11-13 21:41:03 +01:00
parent 3ea9d6c90c
commit ae911d0c73
2 changed files with 4 additions and 2 deletions

View File

@ -33,7 +33,7 @@ TestCaseWidget.prototype.render = function(parent,nextSibling) {
this.execute(); this.execute();
// Create container DOM node // Create container DOM node
var domNode = this.document.createElement("div"); var domNode = this.document.createElement("div");
domNode.setAttribute("class", "tc-test-case"); domNode.setAttribute("class", "tc-test-case " + this.testcaseClass);
this.domNodes.push(domNode); this.domNodes.push(domNode);
parent.insertBefore(domNode,nextSibling); parent.insertBefore(domNode,nextSibling);
// Render the children into a hidden DOM node // Render the children into a hidden DOM node
@ -146,6 +146,7 @@ TestCaseWidget.prototype.execute = function() {
this.testcaseTestActions = this.getAttribute("testActions"); this.testcaseTestActions = this.getAttribute("testActions");
this.testcaseTestExpectedResult = this.getAttribute("testExpectedResult"); this.testcaseTestExpectedResult = this.getAttribute("testExpectedResult");
this.testcaseHideIfPass = this.getAttribute("testHideIfPass"); this.testcaseHideIfPass = this.getAttribute("testHideIfPass");
this.testcaseClass = this.getAttribute("class","");
}; };
/* /*

View File

@ -1,6 +1,6 @@
caption: testcase caption: testcase
created: 20240507221902644 created: 20240507221902644
modified: 20240507221902644 modified: 20241113203728572
tags: Widgets tags: Widgets
title: TestCaseWidget title: TestCaseWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -55,6 +55,7 @@ The content of the `<$testcase>` widget is not displayed but instead is scanned
|<<.attr testExpectedResult>> |Optional title of the tiddler whose content is the expected result of rendering the output tiddler (note that both <<.attr testOutput>> and <<.attr testExpectedResult>> must be provided in order for testing to occur) | |<<.attr testExpectedResult>> |Optional title of the tiddler whose content is the expected result of rendering the output tiddler (note that both <<.attr testOutput>> and <<.attr testExpectedResult>> must be provided in order for testing to occur) |
|<<.attr testActions>> |Optional title of the tiddler containing actions that should be executed before the test occurs | |<<.attr testActions>> |Optional title of the tiddler containing actions that should be executed before the test occurs |
|<<.attr testHideIfPass>> |If set to "yes", hides the <<.wid testcase>> widget if the test passes | |<<.attr testHideIfPass>> |If set to "yes", hides the <<.wid testcase>> widget if the test passes |
|<<.attr class>> |<<.from-version "5.3.7">> Optional CSS classes in addition to the default `tc-test-case` class |
! Payload Tiddlers ! Payload Tiddlers