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 2022/02/23 16:34:43 UTC

[myfaces-tobago] branch master updated: fix(theme): tc:image max-height

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new 9bc1d2c  fix(theme): tc:image max-height
9bc1d2c is described below

commit 9bc1d2c311627af8e6258d40140a1c1de92ffcd2
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Feb 23 17:29:51 2022 +0100

    fix(theme): tc:image max-height
    
    * Width and height values are set on the IMG tag.
    * integration-test added
    
    Issue: TOBAGO-2116
---
 .../content/900-test/1540-image/image.test.js      | 28 ++++++++++++++++++++++
 .../webapp/content/900-test/1540-image/image.xhtml | 28 ++++++++++++++++++++++
 tobago-theme/src/main/scss/_tobago.scss            |  8 +++++--
 3 files changed, 62 insertions(+), 2 deletions(-)

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
new file mode 100644
index 0000000..570b1f2
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.test.js
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {querySelectorFn} from "/script/tobago-test.js";
+import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
+
+it("Images must be among themselves", function (done) {
+  const image1 = querySelectorFn("#page\\:mainForm\\:image1 img");
+  const image2 = querySelectorFn("#page\\:mainForm\\:image2 img");
+
+  let test = new JasmineTestTool(done);
+  test.do(() => expect(image2().offsetTop).toBeGreaterThan(image1().offsetTop + image1().height));
+  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
new file mode 100644
index 0000000..2e94631
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/1540-image/image.xhtml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+  <ui:param name="title" value="Image"/>
+  <tc:image id="image1" value="#{request.contextPath}/image/alps.png">
+    <tc:style maxHeight="10px"/>
+  </tc:image>
+  <p>Images should be among themselves.</p>
+  <tc:image id="image2" value="#{request.contextPath}/image/alps.png"/>
+</ui:composition>
diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index 203c564..bbf872d 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -485,8 +485,12 @@ tobago-image {
   display: inline-block;
 
   > img {
-    width: 100%;
-    height: 100%;
+    width: inherit;
+    height: inherit;
+    min-width: inherit;
+    min-height: inherit;
+    max-width: inherit;
+    max-height: inherit;
   }
 }