Sha256: b95ffa389bd5c040f50fc5c9fa6b1b78ee5b52d68bfb85d5b5230bca1a988361

Contents?: true

Size: 1.21 KB

Versions: 62

Compression:

Stored size: 1.21 KB

Contents

(function () {
    'use strict';

    describe('WORKAREA.cloneableRows', function () {
        describe('init', function () {
            var triggerClone = function ($scope) {
                    $('tr:first [name]', $scope)
                        .first()
                        .trigger('input.cloneableRows');
                },

                $fixture;

            beforeEach(function () {
                var markup = 'cloneable_row.html';

                $fixture = $(fixture.load(markup, true));

                WORKAREA.cloneableRows.init($fixture);
            });

            it('clones its row on field input', function () {
                expect($('tr', $fixture).length).to.equal(1);
                expect($('label', $fixture).attr('for')).to.equal('foo');
                triggerClone($fixture);
                expect($('tr', $fixture).length).to.equal(2);
                expect($('tr:nth-child(2) label', $fixture).attr('for')).not.to.equal('foo');
            });

            it('clones itself only once', function () {
                triggerClone($fixture);
                triggerClone($fixture);

                expect($('tr', $fixture).length).to.equal(2);
            });
        });
    });
}());

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.13 test/javascripts/cloneable_rows_spec.js
workarea-admin-3.4.12 test/javascripts/cloneable_rows_spec.js