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/01 18:15:46 UTC

[myfaces-tobago] 01/02: fix: button.tobago-link

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

commit 77d3481310fcbb07002b2096c333a5f6fc592919
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Feb 1 19:10:48 2022 +0100

    fix: button.tobago-link
    
    Text of a .tobago-link should be left-justified.
---
 .../webapp/content/900-test/2300-link/Link.test.js | 28 +++++++++++++++++++
 .../webapp/content/900-test/2300-link/Link.xhtml   | 31 ++++++++++++++++++++++
 tobago-theme/src/main/scss/_tobago.scss            |  5 ++++
 3 files changed, 64 insertions(+)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.test.js
new file mode 100644
index 0000000..8d7346c
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.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("compare a.link and button.link", function (done) {
+  const aLinkText = querySelectorFn("#page\\:mainForm\\:aLink span");
+  const buttonLinkText = querySelectorFn("#page\\:mainForm\\:buttonLink span");
+
+  const test = new JasmineTestTool(done);
+  test.do(() => expect(aLinkText().offsetLeft).toBe(buttonLinkText().offsetLeft));
+  test.start();
+});
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.xhtml
new file mode 100644
index 0000000..1dcc61b
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/2300-link/Link.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"
+                xmlns:f="http://xmlns.jcp.org/jsf/core">
+  <tc:link id="aLink" label="a.link" link="https://www.apache.org/">
+    <tc:style width="200px"/>
+  </tc:link>
+  <br/>
+  <tc:link id="buttonLink" label="button.link">
+    <tc:style width="200px"/>
+  </tc:link>
+</ui:composition>
diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index 56bd7e2..94bb66e 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -623,6 +623,10 @@ a.tobago-link.dropdown-item {
   }
 }
 
+button.tobago-link {
+  text-align: left;
+}
+
 h1, h2, h3, h4, h5, h6 {
   button.tobago-link {
     font-size: inherit;
@@ -1085,6 +1089,7 @@ tobago-select-boolean-toggle {
 /* selectOneChoice --------------------------------------------------------- */
 tobago-select-one-choice {
   display: block;
+
   select {
     @include formControlDisabled();
   }