Example #1
0
 public void should_handle_different_combos_of_leading_invalid_characters()
 {
     CssClassNameValidator.SanitizeClassName("9-9asdf").ShouldBe("asdf");
     CssClassNameValidator.SanitizeClassName("-99asdf").ShouldBe("asdf");
     CssClassNameValidator.SanitizeClassName("@-99asdf").ShouldBe("asdf");
     CssClassNameValidator.SanitizeClassName("@-99@asdf").ShouldBe("asdf");
 }
Example #2
0
 public void do_nothing_if_already_valid_class_name()
 {
     CssClassNameValidator.SanitizeClassName("asdf").ShouldBe("asdf");
     CssClassNameValidator.SanitizeClassName("-test").ShouldBe("-test");
     CssClassNameValidator.SanitizeClassName("-_test").ShouldBe("-_test");
     CssClassNameValidator.SanitizeClassName("TEST_2-test").ShouldBe("TEST_2-test");
     CssClassNameValidator.SanitizeClassName("-just-4-test").ShouldBe("-just-4-test");
 }
Example #3
0
 public void remove_leading_numbers()
 {
     CssClassNameValidator.SanitizeClassName("9asdf").ShouldBe("asdf");
 }
Example #4
0
 public void return_default_if_completely_invalid_input()
 {
     CssClassNameValidator.SanitizeClassName("-99").ShouldBe(CssClassNameValidator.DefaultClass);
 }
Example #5
0
 public void return_default_if_empty_input()
 {
     CssClassNameValidator.SanitizeClassName("").ShouldBe(CssClassNameValidator.DefaultClass);
 }
Example #6
0
 public void remove_bogus_characters()
 {
     CssClassNameValidator.SanitizeClassName("a!@#$%^&*()`=':;?><|{}[]~sdf").ShouldBe("asdf");
 }
Example #7
0
 public void remove_leading_hyphen_and_numbers_if_not_followed_by_an_underscore_or_alpha_char()
 {
     CssClassNameValidator.SanitizeClassName("-9asdf").ShouldBe("asdf");
 }
Example #8
0
 public void return_default_if_null_input()
 {
     CssClassNameValidator.SanitizeClassName(null).ShouldEqual(CssClassNameValidator.DefaultClass);
 }