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 2023/11/02 11:35:37 UTC

(myfaces-tobago) branch tobago-5.x updated: test: tc:image customClass

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 f83ef9822d test: tc:image customClass
f83ef9822d is described below

commit f83ef9822d5f14b0897d77b7a2301dc63d641c42
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Nov 2 12:17:16 2023 +0100

    test: tc:image customClass
    
    Test if a custom CSS class can be added to tc:image.
    
    Issue: TOBAGO-2255
---
 .../src/main/webapp/content/900-test/1540-image/image.test.js    | 6 +++++-
 .../src/main/webapp/content/900-test/1540-image/image.xhtml      | 9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.test.js
index 3f1b2970fa..0f1667ee6f 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.test.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-import {querySelectorFn} from "/script/tobago-test.js";
+import {elementByIdFn, querySelectorFn,} from "/script/tobago-test.js";
 import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
 
 it("Images must be among themselves", function (done) {
@@ -34,6 +34,8 @@ it("Image sizes", function (done) {
   const image4 = querySelectorFn("#page\\:mainForm\\:image4 img");
   const image5 = querySelectorFn("#page\\:mainForm\\:image5 img");
   const image6 = querySelectorFn("#page\\:mainForm\\:image6 img");
+  const customClassIcon = elementByIdFn("page:mainForm:customClassIcon");
+  const customClassImage = elementByIdFn("page:mainForm:customClassImage");
 
   let test = new JasmineTestTool(done);
   test.do(() => expect(image1().width).toBe(24));
@@ -48,5 +50,7 @@ it("Image sizes", function (done) {
   test.do(() => expect(image5().height).toBe(25));
   test.do(() => expect(image6().width).toBe(240));
   test.do(() => expect(image6().height).toBe(100));
+  test.do(() => expect(customClassIcon().classList).toContain("my-custom-class"));
+  test.do(() => expect(customClassImage().classList).toContain("my-custom-class"));
   test.start();
 });
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.xhtml
index 5f3c774848..f41dca7097 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.xhtml
@@ -62,4 +62,13 @@
       </tc:image>
     </tc:panel>
   </tc:figure>
+
+  <tc:section label="CustomClass">
+    <tc:image id="customClassIcon" value="bi-emoji-smile">
+      <tc:style customClass="my-custom-class" asd=""/>
+    </tc:image>
+    <tc:image id="customClassImage" value="#{request.contextPath}/image/alps.png">
+      <tc:style customClass="my-custom-class"/>
+    </tc:image>
+  </tc:section>
 </ui:composition>