Sha256: d14a328f88c88cc20ce9b6fd61324c60a4e6c46c9b92f0e95416c32bb6c7ea50
Contents?: true
Size: 1.24 KB
Versions: 13
Compression:
Stored size: 1.24 KB
Contents
describe('Service:formUtils', function() { var FormUtils; beforeEach(module('Bastion.utils', 'Bastion.test-mocks')); beforeEach(inject(function($injector) { FormUtils = $injector.get('FormUtils'); })); describe("provides a function that turns a name into a label", function() { var uuidFormat = (/[a-z0-9]{8}-[a-z0-9]{4}-4[a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}/); it("that replaces special characters with underscores", function() { var model = {name: 'a label !@# 123'}; FormUtils.labelize(model); expect(model.label).toBe('a_label_123'); }); it("that will generate a UUID if a non-ascii name is used", function() { var model = {name: 'žluťoučký'}; FormUtils.labelize(model); expect(model.label).toMatch(uuidFormat); }); it("that will generate a UUID if name contains more than 128 characters", function() { var model = {name: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ' + 'Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque pena'}; FormUtils.labelize(model); expect(model.label).toMatch(uuidFormat); }); }); });
Version data entries
13 entries across 13 versions & 1 rubygems