@@ -62,6 +62,7 @@ describe('Iframe class', () => {
62
62
constructorConfig = Object . assign ( { } , configObject , {
63
63
googleFonts : [ 'Arial' , 'Calibri' ] ,
64
64
width : '200px' ,
65
+ title : 'Iframe title' ,
65
66
} ) ;
66
67
createElementSpy = sinon . spy ( document , 'createElement' ) ;
67
68
setWidthStub = sinon . stub ( Iframe . prototype , 'setWidth' ) ;
@@ -137,6 +138,19 @@ describe('Iframe class', () => {
137
138
assert . equal ( iframe . el . getAttribute ( 'name' ) , constructorConfig . name ) ;
138
139
} ) ;
139
140
141
+ it ( 'sets element title to title in config if it exists' , ( ) => {
142
+ assert . equal ( iframe . el . getAttribute ( 'title' ) , constructorConfig . title ) ;
143
+ } ) ;
144
+
145
+ it ( 'does not set element title if it does not exist in the config' , ( ) => {
146
+ constructorConfig . title = null ;
147
+ const setAttributeStub = sinon . stub ( iframe . el , 'setAttribute' ) ;
148
+ iframe = new Iframe ( parent , constructorConfig ) ;
149
+ assert . neverCalledWith ( setAttributeStub , 'title' ) ;
150
+ assert . equal ( iframe . el . getAttribute ( 'title' ) , null ) ;
151
+ setAttributeStub . restore ( ) ;
152
+ } ) ;
153
+
140
154
it ( 'sets styleTag to null' , ( ) => {
141
155
iframe = new Iframe ( parent , constructorConfig ) ;
142
156
assert . equal ( iframe . styleTag = null ) ;
0 commit comments