CustomElementNameValidator { public static boolean isCustomElementName(String name) { return name != null && checkHtmlTagRules(name) && checkWebComponentRules(name); }  static boolean isCustomElementName(String name);  }
@Test public void testInvalidElementNames() { Stream.of("", "foo", "annotation-xml", "0-foo", "-foo", "foo-$", "foo-/", "FOO-BAR", "foo/", "øl-unicorn", "foo-💩") .forEach(name -> Assert.assertFalse(String.format( "Name %s is valid even though it should not be", name), CustomElementNameValidator.isCustomElementName(name))); }
@Test public void testValidNamesWithoutErrorOrWarning() { Stream.of("foo-bar", "custom-element", "date-field", "dos-box") .forEach(name -> Assert.assertTrue(String.format( "Name %s is not valid even though it should be", name), CustomElementNameValidator.isCustomElementName(name))); }
@Test public void testValidButWithWarning() { Stream.of("polymer-", "x-", "ng-", "unicorn-", "unicorn-ø", "uni--corn", "uni-----corn", "uni-co___rn", "uni-co.rn", "uni-corné", "xml-unicorn", "não-tém", "foo-bår") .forEach(name -> Assert.assertTrue(String.format( "Name %s is not valid even though it should be", name), CustomElementNameValidator.isCustomElementName(name))); }