You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/09/04 10:24:30 UTC

svn commit: r1701172 - in /myfaces/tobago/branches/tobago-3.0.x/tobago-core/src: main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java test/java/org/apache/myfaces/tobago/renderkit/html/AriaUnitTest.java

Author: lofwyr
Date: Fri Sep  4 08:24:29 2015
New Revision: 1701172

URL: http://svn.apache.org/r1701172
Log:
TOBAGO-1487: ARIA support code, for the renderer classes.

Added:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/AriaUnitTest.java

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java?rev=1701172&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java Fri Sep  4 08:24:29 2015
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.renderkit.html;
+
+public enum Aria {
+
+  ACTIVEDESCENDANT("aria-activedescendant"),
+  ATOMIC("aria-atomic"),
+  BUSY("aria-busy"),
+  CONTROLS("aria-controls"),
+  DESCRIBEDBY("aria-describedby"),
+  DROPEFFECT("aria-dropeffect"),
+  EXPANDED("aria-expanded"),
+  FLOWTO("aria-flowto"),
+  GRABBED("aria-grabbed"),
+  HASPOPUP("aria-haspopup"),
+  HIDDEN("aria-hidden"),
+  LABEL("aria-label"),
+  LABELLEDBY("aria-labelledby"),
+  LEVEL("aria-level"),
+  LIVE("aria-live"),
+  ORIENTATION("aria-orientation"),
+  OWNS("aria-owns"),
+  POSINSET("aria-posinset"),
+  PRESSED("aria-pressed"),
+  RELEVANT("aria-relevant"),
+  SETSIZE("aria-setsize"),
+  SORT("aria-sort");
+
+  private String value;
+
+  Aria(final String value) {
+    this.value = value;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+}

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/AriaUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/AriaUnitTest.java?rev=1701172&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/AriaUnitTest.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/AriaUnitTest.java Fri Sep  4 08:24:29 2015
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.renderkit.html;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+
+public class AriaUnitTest {
+
+  @Test
+  public void testAttributeNames() throws IllegalAccessException {
+    for (final Field field : Aria.class.getFields()) {
+
+      final Aria aria = (Aria) field.get(null);
+      final String value = aria.getValue();
+      Assert.assertTrue("Regexp check: value='" + aria + "'", value.matches("aria-[a-z0-9]+"));
+
+      final String extension = value.substring("aria-".length());
+      final String name = field.getName();
+      Assert.assertEquals(name, extension.toUpperCase());
+    }
+  }
+
+}