File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ function isTransition(name) {
127
127
}
128
128
129
129
function isHtmlAttribute ( value ) {
130
- return [ "id" , "class" ] . includes ( value ) || value . startsWith ( "data-" ) ;
130
+ return [ "id" , "class" , "role" ] . includes ( value ) || value . startsWith ( "data-" ) || value . startsWith ( "aria -") ;
131
131
}
132
132
133
133
export { isHtmlTag , isHtmlAttribute , isTransition } ;
Original file line number Diff line number Diff line change 1
- import { isHtmlTag , isTransition } from "@/util/tags" ;
1
+ import { isHtmlTag , isTransition , isHtmlAttribute } from "@/util/tags" ;
2
2
3
3
describe ( "isHtmlTag" , ( ) => {
4
4
test . each ( [
@@ -17,6 +17,25 @@ describe("isHtmlTag", () => {
17
17
)
18
18
} ) ;
19
19
20
+ describe ( "isHtmlAttribute" , ( ) => {
21
+ test . each ( [
22
+ [ "class" , true ] ,
23
+ [ "id" , true ] ,
24
+ [ "role" , true ] ,
25
+ [ "data-whatever" , true ] ,
26
+ [ "aria-whatever" , true ] ,
27
+ [ "notattribute" , false ] ,
28
+ [ "href" , false ] ,
29
+ [ "name" , false ] ,
30
+ ] ) (
31
+ "for %s returns %s" ,
32
+ ( value , expected ) => {
33
+ const actual = isHtmlAttribute ( value ) ;
34
+ expect ( actual ) . toEqual ( expected ) ;
35
+ }
36
+ )
37
+ } ) ;
38
+
20
39
describe ( "isTransition" , ( ) => {
21
40
test . each ( [
22
41
[ "TransitionGroup" , true ] ,
You can’t perform that action at this time.
0 commit comments