You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2021/10/14 08:50:04 UTC
[myfaces-tobago] branch tobago-5.x updated: test(Id_Markup):
Implement label tests.
This is an automated email from the ASF dual-hosted git repository.
hnoeth pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/tobago-5.x by this push:
new fd80d60 test(Id_Markup): Implement label tests.
fd80d60 is described below
commit fd80d60bb21c5e45df872e6038f4e3608727449f
Author: lennox_2019 <le...@web.de>
AuthorDate: Wed Oct 13 17:05:10 2021 +0200
test(Id_Markup): Implement label tests.
---
.../100-id-markup/Id_Markup.test.js | 183 ++++++---------------
.../4800-labelLayout/100-id-markup/Id_Markup.xhtml | 40 +++--
2 files changed, 81 insertions(+), 142 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.test.js
index 36a4bb7..65f5493 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.test.js
@@ -16,165 +16,84 @@
*/
import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
+import {querySelectorFn, querySelectorAllFn, elementByIdFn} from "/script/tobago-test.js";
-it("not implemented yet", function (done) {
- let test = new JasmineTestTool(done);
- test.do(() => fail("not implemented yet"));
+it("No label set", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionNoLabel .tobago-section-content > tobago-in input");
+
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
test.start();
});
-/*
-import {querySelectorFn} from "/script/tobago-test.js";
-
-QUnit.test("No label set", function (assert) {
- assert.expect(5);
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionNoLabel");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
+it("labelLayout=none", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionNone .tobago-section-content > tobago-in input");
- assert.equal(rootDiv.id, "page:mainForm:inNoLabel");
- assert.equal(label, null);
- assert.equal(input.id, "page:mainForm:inNoLabel::field");
- assert.equal(input.name, "page:mainForm:inNoLabel");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=none", function (assert) {
- assert.expect(5);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionNone");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
+it("labelLayout=skip", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionSkip .tobago-section-content > tobago-in input");
- assert.equal(rootDiv.id, "page:mainForm:inNone");
- assert.equal(label, null);
- assert.equal(input.id, "page:mainForm:inNone::field");
- assert.equal(input.name, "page:mainForm:inNone");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=skip", function (assert) {
- assert.expect(3);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionSkip");
- let rootInput = sectionFn().querySelector(".tobago-section-content > input");
- let label = sectionFn().querySelector("label");
+it("labelLayout=top", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionTop .tobago-section-content > tobago-in input");
- assert.equal(label, null);
- assert.equal(rootInput.id, "page:mainForm:inSkip");
- assert.ok(rootInput.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=top", function (assert) {
- assert.expect(5);
+it("labelLayout=flowLeft", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionFlowLeft .tobago-section-content > tobago-in input");
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionTop");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
-
- assert.equal(rootDiv.id, "page:mainForm:inTop");
- assert.equal(label.getAttribute('for'), "page:mainForm:inTop::field");
- assert.equal(input.id, "page:mainForm:inTop::field");
- assert.equal(input.name, "page:mainForm:inTop");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=flowLeft", function (assert) {
- assert.expect(5);
+it("labelLayout=flowRight", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionFlowRight .tobago-section-content > tobago-in input");
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionFlowLeft");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
-
- assert.equal(rootDiv.id, "page:mainForm:inFlowLeft");
- assert.equal(label.getAttribute('for'), "page:mainForm:inFlowLeft::field");
- assert.equal(input.id, "page:mainForm:inFlowLeft::field");
- assert.equal(input.name, "page:mainForm:inFlowLeft");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=flowRight", function (assert) {
- assert.expect(5);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionFlowRight");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
+it("labelLayout=flexLeft", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionFlexLeft .tobago-section-content > tobago-in input");
- assert.equal(rootDiv.id, "page:mainForm:inFlowRight");
- assert.equal(label.getAttribute('for'), "page:mainForm:inFlowRight::field");
- assert.equal(input.id, "page:mainForm:inFlowRight::field");
- assert.equal(input.name, "page:mainForm:inFlowRight");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=flexLeft", function (assert) {
- assert.expect(5);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionFlexLeft");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
+it("labelLayout=flexRight", function (done) {
+ const inputFn = querySelectorFn("#page\\:mainForm\\:sectionFlexRight .tobago-section-content > tobago-in input");
- assert.equal(rootDiv.id, "page:mainForm:inFlexLeft");
- assert.equal(label.getAttribute('for'), "page:mainForm:inFlexLeft::field");
- assert.equal(input.id, "page:mainForm:inFlexLeft::field");
- assert.equal(input.name, "page:mainForm:inFlexLeft");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=flexRight", function (assert) {
- assert.expect(5);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionFlexRight");
- let rootDiv = sectionFn().querySelector(".tobago-section-content > tobago-in");
- let label = rootDiv.querySelector("label");
- let input = rootDiv.querySelector("input");
+it("labelLayout=segmentLeft", function (done) {
+ const inputFn = elementByIdFn("page:mainForm:inSegmentLeft::field");
- assert.equal(rootDiv.id, "page:mainForm:inFlexRight");
- assert.equal(label.getAttribute('for'), "page:mainForm:inFlexRight::field");
- assert.equal(input.id, "page:mainForm:inFlexRight::field");
- assert.equal(input.name, "page:mainForm:inFlexRight");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-QUnit.test("labelLayout=segmentLeft", function (assert) {
- assert.expect(6);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionSegmentLeft");
- let segmentLayout = sectionFn().querySelector(".tobago-section-content > div");
- let labelSegment = segmentLayout.querySelector(".col-3 > tobago-in");
- let inputSegment = segmentLayout.querySelector(".col-9 > tobago-in");
- let label = labelSegment.querySelector("label");
- let input = inputSegment.querySelector("input");
-
- assert.equal(labelSegment.id, "page:mainForm:inSegmentLeft::label");
- assert.equal(label.getAttribute('for'), "page:mainForm:inSegmentLeft::field");
- assert.equal(inputSegment.id, "page:mainForm:inSegmentLeft");
- assert.equal(input.id, "page:mainForm:inSegmentLeft::field");
- assert.equal(input.name, "page:mainForm:inSegmentLeft");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
-});
+it("labelLayout=segmentRight", function (done) {
+ const inputFn = elementByIdFn("page:mainForm:inSegmentRight::field");
-QUnit.test("labelLayout=segmentRight", function (assert) {
- assert.expect(6);
-
- let sectionFn = querySelectorFn("#page\\:mainForm\\:sectionSegmentRight");
- let segmentLayout = sectionFn().querySelector(".tobago-section-content > div");
- let labelSegment = segmentLayout.querySelector(".col-3 > tobago-in");
- let inputSegment = segmentLayout.querySelector(".col-9 > tobago-in");
- let label = labelSegment.querySelector("label");
- let input = inputSegment.querySelector("input");
-
- assert.equal(labelSegment.id, "page:mainForm:inSegmentRight::label");
- assert.equal(label.getAttribute('for'), "page:mainForm:inSegmentRight::field");
- assert.equal(inputSegment.id, "page:mainForm:inSegmentRight");
- assert.equal(input.id, "page:mainForm:inSegmentRight::field");
- assert.equal(input.name, "page:mainForm:inSegmentRight");
- assert.ok(input.classList.contains("tobago-in-markup-testmarkup"));
+ const test = new JasmineTestTool(done);
+ test.do(() => expect(inputFn().classList).toContain("testcssclass"));
+ test.start();
});
-*/
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.xhtml
index ebab737..ef902cc 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/4800-labelLayout/100-id-markup/Id_Markup.xhtml
@@ -24,48 +24,68 @@
<ui:param name="title" value="Test position of ids and markups"/>
<tc:section id="sectionNoLabel" label="No label set">
- <tc:in id="inNoLabel" markup="testmarkup"/>
+ <tc:in id="inNoLabel">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
<tc:section id="sectionNone" label="labelLayout=none">
- <tc:in id="inNone" label="Input" markup="testmarkup" labelLayout="none"/>
+ <tc:in id="inNone" label="Input" labelLayout="none">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
<tc:section id="sectionSkip" label="labelLayout=skip">
- <tc:in id="inSkip" label="Input" markup="testmarkup" labelLayout="skip"/>
+ <tc:in id="inSkip" label="Input" labelLayout="skip">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
<tc:section id="sectionTop" label="labelLayout=top">
- <tc:in id="inTop" label="Input" markup="testmarkup" labelLayout="top"/>
+ <tc:in id="inTop" label="Input" labelLayout="top">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
<tc:section label="FlowLayout">
<tc:section id="sectionFlowLeft" label="labelLayout=flowLeft">
- <tc:in id="inFlowLeft" label="Input" markup="testmarkup" labelLayout="flowLeft"/>
+ <tc:in id="inFlowLeft" label="Input" labelLayout="flowLeft">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
<tc:section id="sectionFlowRight" label="labelLayout=flowRight">
- <tc:in id="inFlowRight" label="Input" markup="testmarkup" labelLayout="flowRight"/>
+ <tc:in id="inFlowRight" label="Input" labelLayout="flowRight">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
</tc:section>
<tc:section label="FlexLayout">
<tc:section id="sectionFlexLeft" label="labelLayout=flexLeft">
- <tc:in id="inFlexLeft" label="Input" markup="testmarkup" labelLayout="flexLeft"/>
+ <tc:in id="inFlexLeft" label="Input" labelLayout="flexLeft">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
<tc:section id="sectionFlexRight" label="labelLayout=flexRight">
- <tc:in id="inFlexRight" label="Input" markup="testmarkup" labelLayout="flexRight"/>
+ <tc:in id="inFlexRight" label="Input" labelLayout="flexRight">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:section>
</tc:section>
<tc:section label="SegmentLayout">
<tc:section id="sectionSegmentLeft" label="labelLayout=segmentLeft">
<tc:segmentLayout extraSmall="3seg 9seg">
- <tc:in id="inSegmentLeft" label="Input" markup="testmarkup" labelLayout="segmentLeft"/>
+ <tc:in id="inSegmentLeft" label="Input" labelLayout="segmentLeft">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:segmentLayout>
</tc:section>
<tc:section id="sectionSegmentRight" label="labelLayout=segmentRight">
<tc:segmentLayout extraSmall="9seg 3seg">
- <tc:in id="inSegmentRight" label="Input" markup="testmarkup" labelLayout="segmentRight"/>
+ <tc:in id="inSegmentRight" label="Input" labelLayout="segmentRight">
+ <tc:style customClass="testcssclass"/>
+ </tc:in>
</tc:segmentLayout>
</tc:section>
</tc:section>