Sha256: 830592e0001be808c933c04cf5b72428f2ec2f985014a03f49abfed514ef6e28

Contents?: true

Size: 792 Bytes

Versions: 60

Compression:

Stored size: 792 Bytes

Contents

describe('Filter:arrayToString', function() {
    var array, arrayToStringFilter;

    beforeEach(module('Bastion.components.formatters'));

    beforeEach(inject(function($filter) {
        array = [
            {id: 1, name: 'one'},
            {id: 2, name: 'two'},
            {id: 3, name: 'three'}
        ];
        arrayToStringFilter = $filter('arrayToString');
    }));

    it("transforms an array to a string.", function() {
        expect(arrayToStringFilter(array, "id")).toBe('1, 2, 3');
    });

    it("defaults item to pluck to 'name' if not provided.", function() {
        expect(arrayToStringFilter(array)).toBe('one, two, three');
    });

    it("allows a custom separator", function() {
        expect(arrayToStringFilter(array, "id", ':')).toBe('1:2:3');
    });
});

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
bastion-6.1.13 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.12 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.11 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.10 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.9 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.8 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.7 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.6 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.5 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.4 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.3 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.2 test/components/formatters/array-to-string.filter.test.js
bastion-5.1.1 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.1 test/components/formatters/array-to-string.filter.test.js
bastion-6.1.0 test/components/formatters/array-to-string.filter.test.js
bastion-6.0.0 test/components/formatters/array-to-string.filter.test.js
bastion-5.1.0 test/components/formatters/array-to-string.filter.test.js
bastion-5.0.10 test/components/formatters/array-to-string.filter.test.js
bastion-5.0.9 test/components/formatters/array-to-string.filter.test.js
bastion-5.0.8 test/components/formatters/array-to-string.filter.test.js