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/06/30 13:18:59 UTC
[myfaces-tobago] 01/02: fix: input field 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
commit 9e1bf5acb4f1d41fbfaa870cd26d1fa9ef128b0f
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Wed Jun 30 15:08:32 2021 +0200
fix: input field height
* fix height of input field if label has a greater height
* add test
---
.../200-input-heigth/Input_Height.test.js | 25 +++++++++++++++++
.../200-input-heigth/Input_Height.xhtml | 31 ++++++++++++++++++++++
tobago-theme/src/main/scss/_tobago.scss | 1 +
3 files changed, 57 insertions(+)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/200-input-heigth/Input_Height.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/200-input-heigth/Input_Height.test.js
new file mode 100644
index 0000000..78da704
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/200-input-heigth/Input_Height.test.js
@@ -0,0 +1,25 @@
+/*
+ * 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 {elementByIdFn} from "/script/tobago-test.js";
+
+it("height of input fields must be the same", function () {
+ const firstFn = elementByIdFn("page:mainForm:first::field");
+ const secondFn = elementByIdFn("page:mainForm:second::field");
+
+ expect(getComputedStyle(secondFn()).height).toBe(getComputedStyle(firstFn()).height);
+});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/200-input-heigth/Input_Height.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/200-input-heigth/Input_Height.xhtml
new file mode 100644
index 0000000..502aa40
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/200-input-heigth/Input_Height.xhtml
@@ -0,0 +1,31 @@
+<?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="Test position of ids and markups"/>
+
+ <tc:section id="sectionNoLabel" label="Test height of input field">
+ <p>The first input has the default height. The second input field should have the same height.</p>
+ <tc:in id="first"/>
+ <tc:in id="second" label="very long label that is higher than the input field"/>
+ </tc:section>
+</ui:composition>
diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index 81df459..d39e27f 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -384,6 +384,7 @@ tobago-flex-layout {
/* the non-label-element inside of a label-layout with flex box */
.tobago-label-container {
display: flex;
+ align-items: center;
> label {
// XXX needs to be customizable