@@ -43,4 +43,52 @@ describe('focusable-element tests', function() {
4343 var actual = check . evaluate . apply ( checkContext , params ) ;
4444 assert . isTrue ( actual ) ;
4545 } ) ;
46+
47+ it ( 'returns true when element made focusable by contenteditable' , function ( ) {
48+ var params = checkSetup (
49+ '<p id="target" contenteditable>I hold some text </p>'
50+ ) ;
51+ var actual = check . evaluate . apply ( checkContext , params ) ;
52+ assert . isTrue ( actual ) ;
53+ } ) ;
54+
55+ it ( 'returns true when element made focusable by contenteditable="true"' , function ( ) {
56+ var params = checkSetup (
57+ '<p id="target" contenteditable="true">I hold some text </p>'
58+ ) ;
59+ var actual = check . evaluate . apply ( checkContext , params ) ;
60+ assert . isTrue ( actual ) ;
61+ } ) ;
62+
63+ it ( 'returns false when element made focusable by contenteditable="false"' , function ( ) {
64+ var params = checkSetup (
65+ '<p id="target" contenteditable="false">I hold some text </p>'
66+ ) ;
67+ var actual = check . evaluate . apply ( checkContext , params ) ;
68+ assert . isFalse ( actual ) ;
69+ } ) ;
70+
71+ it ( 'returns true when element made focusable by contenteditable="invalid" and parent is contenteditable' , function ( ) {
72+ var params = checkSetup (
73+ '<div contenteditable><p id="target" contenteditable="invalid">I hold some text </p></div>'
74+ ) ;
75+ var actual = check . evaluate . apply ( checkContext , params ) ;
76+ assert . isTrue ( actual ) ;
77+ } ) ;
78+
79+ it ( 'returns false when element made focusable by contenteditable="invalid" and parent is not contenteditable' , function ( ) {
80+ var params = checkSetup (
81+ '<div><p id="target" contenteditable="invalid">I hold some text </p></div>'
82+ ) ;
83+ var actual = check . evaluate . apply ( checkContext , params ) ;
84+ assert . isFalse ( actual ) ;
85+ } ) ;
86+
87+ it ( 'returns false when element made focusable by contenteditable="invalid" and parent is contenteditable="false"' , function ( ) {
88+ var params = checkSetup (
89+ '<div contenteditable="false"><p id="target" contenteditable="invalid">I hold some text </p></div>'
90+ ) ;
91+ var actual = check . evaluate . apply ( checkContext , params ) ;
92+ assert . isFalse ( actual ) ;
93+ } ) ;
4694} ) ;
0 commit comments