Sha256: c72bdba6882b1754136e7717194249ce7bed72858408e96165028d243eba5e59

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 KB

Contents

describe('FontApiUrlBuilder', function () {
  var FontApiUrlBuilder = webfont.FontApiUrlBuilder;

  it('should throw an exception if there are no font families', function () {
    var builder = new FontApiUrlBuilder('http://moo', 'http:');
    expect(builder.build).toThrow();
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder('http://moo', 'http:');
    builder.setFontFamilies(['Font1', 'Font2']);
    expect(builder.build()).toEqual('http://moo?family=Font1%7CFont2');
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder(undefined, 'http:');
    builder.setFontFamilies(['Font1', 'Font2']);
    expect(builder.build()).toEqual('http:' +
      FontApiUrlBuilder.DEFAULT_API_URL +
      '?family=Font1%7CFont2');
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder(undefined, 'http:');
    builder.setFontFamilies(['Font1:bold:greek,cyrillic', 'Font2:italic', 'Font3']);
    expect(builder.build()).toEqual('http:' +
      FontApiUrlBuilder.DEFAULT_API_URL +
      '?family=Font1:bold%7CFont2:italic%7CFont3' +
      '&subset=greek,cyrillic');
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder(undefined, 'http:');
    builder.setFontFamilies(['Font1:bold,italic:greek,cyrillic', 'Font2:italic', 'Font3::latin']);
    expect(builder.build()).toEqual('http:' +
      FontApiUrlBuilder.DEFAULT_API_URL +
      '?family=Font1:bold,italic%7CFont2:italic%7CFont3' +
      '&subset=greek,cyrillic,latin');
  });
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
webfontloader-1.4.4 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.4.3 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.4.2 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.4.1 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.4.0 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.3.2 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.3.1 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.3.0 spec/google/fontapiurlbuilder_spec.js
webfontloader-1.2.1 spec/google/fontapiurlbuilder_spec.js