1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-12 03:00:28 +00:00

Add tc-test-case class to testcase-widget (#8744)

* add tc-tesc-case class to testcase-widget

* add default and custom class to testcase-widget

* Testcase widget update tests for default and custom class definitions
This commit is contained in:
Mario Pietsch 2024-12-05 13:33:27 +01:00 committed by GitHub
parent c7f741d4f8
commit 42b2b9fd20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 10 additions and 7 deletions

View File

@ -33,6 +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 " + 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
@ -145,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

@ -24,4 +24,4 @@ This is a payload tiddler from a compound tiddler
+ +
title: ExpectedResult title: ExpectedResult
<p><div><div>[{"title":"Payload Tiddler","tags":"Alpha Beta Gamma","text":"This is a payload tiddler from a compound tiddler","custom":"Alpha"}]</div></div></p> <p><div class="tc-test-case "><div>[{"title":"Payload Tiddler","tags":"Alpha Beta Gamma","text":"This is a payload tiddler from a compound tiddler","custom":"Alpha"}]</div></div></p>

View File

@ -20,4 +20,4 @@ This is the tiddler HelloThere
+ +
title: ExpectedResult title: ExpectedResult
<p><div><div>[{"title":"RealTitle","tags":"Definitions","text":"This is the tiddler HelloThere"}]</div></div></p> <p><div class="tc-test-case "><div>[{"title":"RealTitle","tags":"Definitions","text":"This is the tiddler HelloThere"}]</div></div></p>

View File

@ -25,4 +25,4 @@ This is the tiddler AnotherDefinition
+ +
title: ExpectedResult title: ExpectedResult
<p><div><div>[{"title":"AnotherDefinition","tags":"Definitions","text":"This is the tiddler AnotherDefinition","custom":"Alpha"},{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]</div></div></p> <p><div class="tc-test-case "><div>[{"title":"AnotherDefinition","tags":"Definitions","text":"This is the tiddler AnotherDefinition","custom":"Alpha"},{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]</div></div></p>

View File

@ -20,4 +20,4 @@ This is the tiddler HelloThere
+ +
title: ExpectedResult title: ExpectedResult
<p><div><div>[{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]</div></div></p> <p><div class="tc-test-case "><div>[{"title":"HelloThere","tags":"Definitions","text":"This is the tiddler HelloThere","custom":"Alpha"}]</div></div></p>

View File

@ -9,10 +9,10 @@ text: Standalone data widget to create individual tiddlers
title: Output title: Output
\whitespace trim \whitespace trim
<$testcase template="$:/core/ui/testcases/RawJSONTemplate"> <$testcase template="$:/core/ui/testcases/RawJSONTemplate" class="my-class an-other-class">
<$data title="Epsilon" text="Theta"/> <$data title="Epsilon" text="Theta"/>
</$testcase> </$testcase>
+ +
title: ExpectedResult title: ExpectedResult
<p><div><div>[{"title":"Epsilon","text":"Theta"}]</div></div></p> <p><div class="tc-test-case my-class an-other-class"><div>[{"title":"Epsilon","text":"Theta"}]</div></div></p>

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