Sha256: 06ae05a14f508f669814f2427c9aa5f17955d5e04af04fa493f4650b8f644463

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

describe('format', function() {
  var formatFilter;

  beforeEach(module('ui.filters'));
  beforeEach(inject(function($filter) {
    formatFilter = $filter('format');
  }));

  it('should replace all instances of $0 if string token is passed', function() {
    expect(formatFilter('First $0, then $0, finally $0', 'bob')).toEqual('First bob, then bob, finally bob');
  });
  it('should replace all instances of $n based on order of token array', function() {
    expect(formatFilter('First is $0, then $1, finally $2', ['bob','frank','dianne'])).toEqual('First is bob, then frank, finally dianne');
  });
  it('should replace all instances :tokens based on keys of token object', function() {
    expect(formatFilter('First is :first, next is :second, finally there is :third', {first:'bob',second:'frank',third:'dianne'})).toEqual('First is bob, next is frank, finally there is dianne');
  });
  it('should do nothing if tokens are undefined', function() {
    expect(formatFilter('Hello There')).toEqual('Hello There');
  });
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui/modules/filters/format/test/formatSpec.js