Sha256: 70559ba95cea00cbb9f69f5d366a7548e120e69cea0b702c75213c377e96f2a8

Contents?: true

Size: 1.16 KB

Versions: 61

Compression:

Stored size: 1.16 KB

Contents

var I18n = require("../../app/assets/javascripts/i18n");

describe("Prepare options", function(){
  beforeEach(function(){
    I18n.reset();
  });

  it("merges two objects", function(){
    var options = I18n.prepareOptions(
      {name: "Mary Doe"},
      {name: "John Doe", role: "user"}
    );

    expect(options.name).toEqual("Mary Doe");
    expect(options.role).toEqual("user");
  });

  it("merges multiple objects", function(){
    var options = I18n.prepareOptions(
      {name: "Mary Doe"},
      {name: "John Doe", role: "user"},
      {age: 33},
      {email: "mary@doe.com", url: "http://marydoe.com"},
      {role: "admin", email: "john@doe.com"}
    );

    expect(options.name).toEqual("Mary Doe");
    expect(options.role).toEqual("user");
    expect(options.age).toEqual(33);
    expect(options.email).toEqual("mary@doe.com");
    expect(options.url).toEqual("http://marydoe.com");
  });

  it("returns an empty object when values are null", function(){
    expect(I18n.prepareOptions(null, null)).toEqual({});
  });

  it("returns an empty object when values are undefined", function(){
    expect(I18n.prepareOptions(undefined, undefined)).toEqual({});
  });
});

Version data entries

61 entries across 61 versions & 3 rubygems

Version Path
i18n-js-3.9.2 spec/js/prepare_options.spec.js
i18n-js-3.9.1 spec/js/prepare_options.spec.js
i18n-js-3.9.0 spec/js/prepare_options.spec.js
i18n-js-3.8.4 spec/js/prepare_options.spec.js
i18n-js-3.8.3 spec/js/prepare_options.spec.js
i18n-js-3.8.2 spec/js/prepare_options.spec.js
i18n-js-3.8.1 spec/js/prepare_options.spec.js
i18n-js-3.8.0 spec/js/prepare_options.spec.js
i18n-js-3.7.1 spec/js/prepare_options.spec.js
i18n-js-3.7.0 spec/js/prepare_options.spec.js
i18n-js-3.6.0 spec/js/prepare_options.spec.js
i18n-js-3.5.1 spec/js/prepare_options.spec.js
i18n-js-3.5.0 spec/js/prepare_options.spec.js
i18n-js-3.4.2 spec/js/prepare_options.spec.js
i18n-js-3.4.1 spec/js/prepare_options.spec.js
i18n-js-3.4.0 spec/js/prepare_options.spec.js
i18n-js-3.3.0 spec/js/prepare_options.spec.js
i18n-js-3.2.3 spec/js/prepare_options.spec.js
i18n-js-3.2.2 spec/js/prepare_options.spec.js
i18n-js-3.2.1 spec/js/prepare_options.spec.js