Sha256: a6322618babf4bdabf9a57b25ac97a45a9109e3c9c7ea1bab65f4aa7ff031e8a

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

describe('multi map', function() {
  var multiMap;

  beforeEach(module('ui.bootstrap.modal'));
  beforeEach(inject(function($$multiMap) {
    multiMap = $$multiMap.createNew();
  }));

  it('should add and remove objects by key', function() {
    multiMap.put('foo', 'bar');

    expect(multiMap.get('foo')).toEqual(['bar']);

    multiMap.put('foo', 'baz');

    expect(multiMap.get('foo')).toEqual(['bar', 'baz']);

    multiMap.remove('foo', 'bar');

    expect(multiMap.get('foo')).toEqual(['baz']);

    multiMap.remove('foo', 'baz');

    expect(multiMap.hasKey('foo')).toBe(false);
  });

  it('should support getting the keys', function() {
    multiMap.put('foo', 'bar');
    multiMap.put('baz', 'boo');

    expect(multiMap.keys()).toEqual(['foo', 'baz']);
  });

  it('should return all entries', function() {
    multiMap.put('foo', 'bar');
    multiMap.put('foo', 'bar2');
    multiMap.put('baz', 'boo');

    expect(multiMap.entries()).toEqual([
      {
        key: 'foo',
        value: ['bar', 'bar2']
      },
      {
        key: 'baz',
        value: ['boo']
      }
    ]);
  });

  it('should preserve semantic of an empty key', function() {
    expect(multiMap.get('key')).toBeUndefined();
  });

  it('should respect removal of non-existing elements', function() {
    expect(multiMap.remove('foo', 'bar')).toBeUndefined();
  });
});

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-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/modal/test/multiMap.spec.js