File tree Expand file tree Collapse file tree 3 files changed +60
-1
lines changed
Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 193193 var rslt = [ ] ;
194194
195195 for ( var i = 0 ; i < ffs . length ; i ++ ) {
196+ ffs [ i ] = ffs [ i ] . trim ( ) ;
196197
197198 if ( ffs [ i ] . charAt ( 0 ) !== "'" && ffs [ i ] . charAt ( 0 ) !== '"' ) {
198199
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <tt xml : lang =" en" xmlns =" http://www.w3.org/ns/ttml" xmlns : ttm =" http://www.w3.org/ns/ttml#metadata"
3+ xmlns:ttp=" http://www.w3.org/ns/ttml#parameter" ttp : profile =" http://www.w3.org/ns/ttml/profile/imsc1/text"
4+ xmlns:tts=" http://www.w3.org/ns/ttml#styling" ttp : cellResolution =" 1 1" tts : extent =" 100px 100px" >
5+ <head >
6+ </head >
7+ <body >
8+ <div >
9+ <p tts : fontFamily =" default" >Maps 'default' generic family name to 'monospaceSerif' correctly.</p >
10+ <p tts : fontFamily =" Arial,default" >Maps 'default' value used as a fallback to 'monospaceSerif' correctly.</p >
11+ <p tts : fontFamily =" Arial, default " >Maps 'default' value used as a fallback with spacing characters to 'monospaceSerif' correctly.</p >
12+ <p tts : fontFamily =" 'My Test Font', default " >Fonts names wrapped in '' are preserved.</p >
13+ <p tts : fontFamily =' "My Test Font", default ' >Fonts names wrapped in "" are preserved.</p >
14+ </div >
15+ </body >
16+ </tt >
Original file line number Diff line number Diff line change @@ -167,4 +167,46 @@ QUnit.test(
167167 return getIMSC1Document ( "unit-tests/metadataHandler.ttml" , mh ) ;
168168
169169 }
170- ) ;
170+ ) ;
171+
172+ QUnit . test (
173+ "Font Family Parsing" ,
174+ function ( assert ) {
175+
176+ return getIMSC1Document ( "unit-tests/fontFamily.ttml" ) . then (
177+ function ( doc ) {
178+
179+ assert . deepEqual (
180+ doc . body . contents [ 0 ] . contents [ 0 ] . styleAttrs [ "http://www.w3.org/ns/ttml#styling fontFamily" ] ,
181+ [ "monospaceSerif" ] ,
182+ "Maps 'default' generic family name to 'monospaceSerif' correctly."
183+ ) ;
184+
185+ assert . deepEqual (
186+ doc . body . contents [ 0 ] . contents [ 1 ] . styleAttrs [ "http://www.w3.org/ns/ttml#styling fontFamily" ] ,
187+ [ "Arial" , "monospaceSerif" ] ,
188+ "Maps 'default' value used as a fallback to 'monospaceSerif' correctly."
189+ ) ;
190+
191+ assert . deepEqual (
192+ doc . body . contents [ 0 ] . contents [ 2 ] . styleAttrs [ "http://www.w3.org/ns/ttml#styling fontFamily" ] ,
193+ [ "Arial" , "monospaceSerif" ] ,
194+ "Maps 'default' value used as a fallback with spacing characters to 'monospaceSerif' correctly."
195+ ) ;
196+
197+ assert . deepEqual (
198+ doc . body . contents [ 0 ] . contents [ 3 ] . styleAttrs [ "http://www.w3.org/ns/ttml#styling fontFamily" ] ,
199+ [ "'My Test Font'" , "monospaceSerif" ] ,
200+ "Fonts names wrapped in '' are preserved."
201+ ) ;
202+
203+ assert . deepEqual (
204+ doc . body . contents [ 0 ] . contents [ 4 ] . styleAttrs [ "http://www.w3.org/ns/ttml#styling fontFamily" ] ,
205+ [ '"My Test Font"' , "monospaceSerif" ] ,
206+ 'Fonts names wrapped in "" are preserved.'
207+ ) ;
208+ }
209+ ) ;
210+
211+ }
212+ ) ;
You can’t perform that action at this time.
0 commit comments