Sha256: 1d88963aabeb093bc57633c52c43aada0dc592915f52ac064bc643475d22fb5c

Contents?: true

Size: 1.54 KB

Versions: 62

Compression:

Stored size: 1.54 KB

Contents

//= require workarea/core/modules/string

(function () {
    'use strict';

    describe('WORKAREA.string', function () {
        describe('titleize', function () {
            it('titleizes a given string', function () {
                expect(WORKAREA.string.titleize('foo   ')).to.equal('Foo');
                expect(WORKAREA.string.titleize('BAR')).to.equal('Bar');
                expect(WORKAREA.string.titleize('fOoBaR')).to.equal('Foobar');
            });
        });

        describe('pluralize', function () {
            it('returns a custom pluralized string', function () {
                expect(WORKAREA.string.pluralize(2, 'baz', 'bazes')).to.equal('bazes');
            });

            it('returns a simple pluralized string', function () {
                expect(WORKAREA.string.pluralize(2, 'bar')).to.equal('bars');
            });

            it('returns an unpluralized string', function () {
                expect(WORKAREA.string.pluralize(1, 'foo')).to.equal('foo');
            });
        });

        describe('dasherize', function () {
            it('converts to lowercase', function () {
                expect(WORKAREA.string.dasherize('FOO')).to.equal('foo');
            });

            it('replaces spaces with dashes', function () {
                expect(WORKAREA.string.dasherize('foo bar')).to.equal('foo-bar');
                expect(WORKAREA.string.dasherize('foo      bar')).to.equal('foo-bar');
                expect(WORKAREA.string.dasherize('foo bar baz')).to.equal('foo-bar-baz');
            });
        });
    });
}());

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/javascripts/string_spec.js
workarea-core-3.5.26 test/javascripts/string_spec.js
workarea-core-3.4.45 test/javascripts/string_spec.js
workarea-core-3.5.25 test/javascripts/string_spec.js
workarea-core-3.5.23 test/javascripts/string_spec.js
workarea-core-3.4.44 test/javascripts/string_spec.js
workarea-core-3.5.22 test/javascripts/string_spec.js
workarea-core-3.4.43 test/javascripts/string_spec.js
workarea-core-3.5.21 test/javascripts/string_spec.js
workarea-core-3.4.42 test/javascripts/string_spec.js
workarea-core-3.5.20 test/javascripts/string_spec.js
workarea-core-3.4.41 test/javascripts/string_spec.js
workarea-core-3.5.19 test/javascripts/string_spec.js
workarea-core-3.4.40 test/javascripts/string_spec.js
workarea-core-3.5.18 test/javascripts/string_spec.js
workarea-core-3.4.39 test/javascripts/string_spec.js
workarea-core-3.5.17 test/javascripts/string_spec.js
workarea-core-3.4.38 test/javascripts/string_spec.js
workarea-core-3.5.16 test/javascripts/string_spec.js
workarea-core-3.4.37 test/javascripts/string_spec.js