@@ -49,15 +49,15 @@ describe( 'AttributeCommand', () => {
4949 } ) ;
5050
5151 describe ( 'value' , ( ) => {
52- it ( 'is true when selection has the attribute' , ( ) => {
52+ it ( 'is true when collapsed selection has the attribute' , ( ) => {
5353 model . change ( writer => {
5454 writer . setSelectionAttribute ( attrKey , true ) ;
5555 } ) ;
5656
5757 expect ( command . value ) . to . be . true ;
5858 } ) ;
5959
60- it ( 'is false when selection does not have the attribute' , ( ) => {
60+ it ( 'is false when collapsed selection does not have the attribute' , ( ) => {
6161 model . change ( writer => {
6262 writer . setSelectionAttribute ( attrKey , true ) ;
6363 } ) ;
@@ -69,8 +69,31 @@ describe( 'AttributeCommand', () => {
6969 expect ( command . value ) . to . be . false ;
7070 } ) ;
7171
72- // See https://github.com/ckeditor/ckeditor5-core/issues/73#issuecomment-311572827.
73- it ( 'is false when selection contains object with nested editable' , ( ) => {
72+ it ( 'is true when the first item that allows attribute has the attribute set #1' , ( ) => {
73+ setData ( model , '<p><$text bold="true">fo[o</$text></p><h1>b]ar</h1>' ) ;
74+
75+ expect ( command . value ) . to . be . true ;
76+ } ) ;
77+
78+ it ( 'is true when the first item that allows attribute has the attribute set #2' , ( ) => {
79+ setData ( model , '<h1>fo[o</h1><p><$text bold="true">f</$text>o]o</p>' ) ;
80+
81+ expect ( command . value ) . to . be . true ;
82+ } ) ;
83+
84+ it ( 'is false when the first item that allows attribute does not have the attribute set #1' , ( ) => {
85+ setData ( model , '<p>b[a<$text bold="true">r</$text></p><h1>fo]o</h1>' ) ;
86+
87+ expect ( command . value ) . to . be . false ;
88+ } ) ;
89+
90+ it ( 'is false when the first item that allows attribute does not have the attribute set #2' , ( ) => {
91+ setData ( model , '<h1>fo[o</h1><p>b<$text bold="true">r</$text>r]</p>' ) ;
92+
93+ expect ( command . value ) . to . be . false ;
94+ } ) ;
95+
96+ it ( 'is true when the first item that allows attribute has the attribute set - object with nested editable' , ( ) => {
7497 model . schema . register ( 'caption' , {
7598 allowContentOf : '$block' ,
7699 allowIn : 'img' ,
@@ -85,7 +108,7 @@ describe( 'AttributeCommand', () => {
85108
86109 expect ( command . value ) . to . be . false ;
87110 command . execute ( ) ;
88- expect ( command . value ) . to . be . false ;
111+ expect ( command . value ) . to . be . true ;
89112
90113 expect ( getData ( model ) ) . to . equal (
91114 '<p>[<img><caption><$text bold="true">Some caption inside the image.</$text></caption></img>]</p>'
0 commit comments