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.15 test/javascripts/string_spec.js
workarea-core-3.4.36 test/javascripts/string_spec.js
workarea-core-3.5.14 test/javascripts/string_spec.js
workarea-core-3.4.35 test/javascripts/string_spec.js
workarea-core-3.5.13 test/javascripts/string_spec.js
workarea-core-3.4.34 test/javascripts/string_spec.js
workarea-core-3.5.12 test/javascripts/string_spec.js
workarea-core-3.4.33 test/javascripts/string_spec.js
workarea-core-3.5.11 test/javascripts/string_spec.js
workarea-core-3.5.10 test/javascripts/string_spec.js
workarea-core-3.4.32 test/javascripts/string_spec.js
workarea-core-3.5.9 test/javascripts/string_spec.js
workarea-core-3.4.31 test/javascripts/string_spec.js
workarea-core-3.5.8 test/javascripts/string_spec.js
workarea-core-3.4.30 test/javascripts/string_spec.js
workarea-core-3.5.7 test/javascripts/string_spec.js
workarea-core-3.4.29 test/javascripts/string_spec.js
workarea-core-3.5.6 test/javascripts/string_spec.js
workarea-core-3.4.28 test/javascripts/string_spec.js
workarea-core-3.5.5 test/javascripts/string_spec.js