Sha256: 37cf27362bf55fc2877cb3ae24dcc36b9a11c1246965ad27f1abb9d21264aa5c

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

describe('CssFontFamilyName', function () {
  var CssFontFamilyName = webfont.CssFontFamilyName,
      sanitizer = new CssFontFamilyName();

  describe('#quote', function () {
    it('should quote names with spaces', function () {
      expect(sanitizer.quote('My Family')).toEqual("'My Family'");
    });

    it('should quote names with spaces and double quotes', function () {
      expect(sanitizer.quote('"My Family"')).toEqual("'My Family'");
    });

    it('should quote names with spaces and single quotes', function () {
      expect(sanitizer.quote("'My Family'")).toEqual("'My Family'");
    });

    it('should quote multiple single quoted names separated with a comma', function () {
      expect(sanitizer.quote("'family 1','family 2'")).toEqual("'family 1','family 2'");
    });

    it('should quote multiple single quoted names separated with a comma and space', function () {
      expect(sanitizer.quote("'family 1', 'family 2'")).toEqual("'family 1','family 2'");
    });

    it('should not quote when there is no space', function () {
      expect(sanitizer.quote('MyFamily')).toEqual('MyFamily');
    });

    it('should remove quotes when they are unnecesssary', function () {
      expect(sanitizer.quote('"MyFamily"')).toEqual('MyFamily');
    });

    it('should not quote multiple names when there is no space', function () {
      expect(sanitizer.quote("'family-1', 'family-2'")).toEqual('family-1,family-2');
    });
  });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webfontloader-1.4.0 spec/core/cssfontfamilyname_spec.js
webfontloader-1.3.2 spec/core/cssfontfamilyname_spec.js
webfontloader-1.3.1 spec/core/cssfontfamilyname_spec.js
webfontloader-1.3.0 spec/core/cssfontfamilyname_spec.js
webfontloader-1.2.1 spec/core/cssfontfamilyname_spec.js