File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 11import p5 from '../../../src/app.js' ;
2+ import { _sanitizeFontName } from '../../../src/type/p5.Font.js' ;
23
34suite ( 'p5.Font' , function ( ) {
45 var myp5 ;
@@ -51,3 +52,23 @@ suite('p5.Font', function () {
5152 } ) ;
5253 } ) ;
5354} ) ;
55+
56+ suite ( 'sanitizeFontName' , function ( ) {
57+ test ( 'fully alphabetic or alpha-leading alnum do not need quotes' , function ( ) {
58+ assert . equal ( _sanitizeFontName ( 'Arial' ) , 'Arial' ) ;
59+ assert . equal ( _sanitizeFontName ( 'Family900' ) , 'Family900' ) ;
60+ assert . equal ( _sanitizeFontName ( 'A_b-c' ) , 'A_b-c' ) ;
61+ } ) ;
62+
63+ test ( 'names starting with a digit need quotes' , function ( ) {
64+ assert . equal ( _sanitizeFontName ( '9lives' ) , "'9lives'" ) ;
65+ } ) ;
66+
67+ test ( 'names with spaces need quotes' , function ( ) {
68+ assert . equal ( _sanitizeFontName ( 'My Font' ) , "'My Font'" ) ;
69+ } ) ;
70+
71+ test ( 'names with commas need quotes' , function ( ) {
72+ assert . equal ( _sanitizeFontName ( 'Foo,Bar' ) , "'Foo,Bar'" ) ;
73+ } ) ;
74+ } ) ;
You can’t perform that action at this time.
0 commit comments