Sha256: e0762855b40d349f14d5e654318245a421d10ff729b43670f91b750599675599

Contents?: true

Size: 1.34 KB

Versions: 21

Compression:

Stored size: 1.34 KB

Contents

/**
 * Copyright 2014 Red Hat, Inc.
 *
 * This software is licensed to you under the GNU General Public
 * License as published by the Free Software Foundation; either version
 * 2 of the License (GPLv2) or (at your option) any later version.
 * There is NO WARRANTY for this software, express or implied,
 * including the implied warranties of MERCHANTABILITY,
 * NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
 * have received a copy of GPLv2 along with this software; if not, see
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
 */
describe('Filter:booleanToYesNo', function() {
    var filter;

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

    beforeEach(module(function($provide) {
        $provide.value('translate',  function(a) {return a});
    }));

    beforeEach(inject(function($filter) {
        filter = $filter('booleanToYesNo');
    }));

    it("returns 'Yes' for true, and 'No' for false", function() {
        expect(filter(true)).toBe('Yes');
        expect(filter(false)).toBe('No');
    });

    it("returns an empty string for null", function() {
        expect(filter()).toBe('');
        expect(filter('')).toBe('');
    });

    it("allows Yes and No to be overriden", function() {
        expect(filter(true, 'ok', 'fail')).toBe('ok');
        expect(filter(false, 'ok', 'fail')).toBe('fail');
    });

});

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
bastion-0.3.3 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-1.0.1 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.3.2 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-1.0.0 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.3.1 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.3.0 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.9 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.8 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.7 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.6 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.1.14 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.5 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.3 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.2 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.1 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.2.0 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.1.13 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.1.12 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.1.11 test/components/formatters/boolean-to-yes-no.filter.test.js
bastion-0.1.10 test/components/formatters/boolean-to-yes-no.filter.test.js