diff options
author | Code Raguet <ignacio.code@gmail.com> | 2013-08-16 17:19:15 (GMT) |
---|---|---|
committer | Code Raguet <ignacio.code@gmail.com> | 2013-08-16 17:19:15 (GMT) |
commit | 1101373de9297176d11c7471a0cf59e6c6a7eacb (patch) | |
tree | b4ecf5eccce50497cf903ade2f38bb8472d4fe2c /webapp/js_tests/spec/DynamicStructureSpec.js | |
parent | 631ccd38bb09a152eaa61892a63f78381da4f33f (diff) | |
parent | 7cb74551d3208130961219d0dfcd4e44eb0a0a26 (diff) |
Merge branch 'DEV'v4.11
Diffstat (limited to 'webapp/js_tests/spec/DynamicStructureSpec.js')
-rw-r--r-- | webapp/js_tests/spec/DynamicStructureSpec.js | 281 |
1 files changed, 0 insertions, 281 deletions
diff --git a/webapp/js_tests/spec/DynamicStructureSpec.js b/webapp/js_tests/spec/DynamicStructureSpec.js index f35a93d..8b5c84b 100644 --- a/webapp/js_tests/spec/DynamicStructureSpec.js +++ b/webapp/js_tests/spec/DynamicStructureSpec.js @@ -159,285 +159,4 @@ describe("", function() { }); - describe("Fields", function() { - - beforeEach(function() { - - jasmine.getFixtures().fixturesPath = "fixtures/"; - loadFixtures("container.html"); - - var field_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/field.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(field_mustache_template); - - Mustache.tags = ['[[', ']]']; - - // Preparing mustache TEMPLATES - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - }); - - it("- Field template must contains right classes", function() { - var field_template = $(TEMPLATES['field']); - - var field_remove_button = field_template.find('.WField_remove'); - expect(field_remove_button).toExist(); - expect(field_remove_button).toBe(':button'); - - expect(field_template.find('.error')).toExist(); - - expect(field_template.find('.WFieldWidgetType')).toExist(); - - expect(field_template.find('.WFieldAddOptionButton_container')).toExist(); - - expect(field_template.find('.WFieldOptions_container')).toExist(); - }); - - it("Second option must has greater order than firt option", function() { - - // Preparing mustache TEMPLATES - var option_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_mustache_template); - - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - factoryField("0", {"container": container, "widget_type": "MultipleCheckBox"}); - - var field_widget = container.children(); - var field_add_option_button = $(field_widget.find('.WFieldOptions_add_button')); - field_add_option_button = field_add_option_button.find('button'); - field_add_option_button.click(); - var first_option = $(field_widget.find(".WFieldOptions_container .row-fluid")[0]); - - var field_widget = container.children(); - var field_add_option_button = $(field_widget.find('.WFieldOptions_add_button')); - field_add_option_button = field_add_option_button.find('button'); - field_add_option_button.click(); - var second_option = $(field_widget.find(".WFieldOptions_container .row-fluid")[1]); - - var first_option_order = $(first_option.find("[name*='.order']")[0]).val(); - var second_option_order = $(second_option.find("[name*='.order']")[0]).val(); - - expect( first_option_order ).toBeLessThan( second_option_order ); - - }); - - describe("Options except TextInput and image widget types", function() { - - it("option widget has an order", function() { - - jasmine.getFixtures().fixturesPath = "fixtures/"; - loadFixtures("container.html"); - - var option_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_mustache_template); - - Mustache.tags = ['[[', ']]']; - - // Preparing mustache TEMPLATES - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - factoryOption("1", "", container, "0", "0"); - - options = container.children(); - - option_1_order = options.find( - "[name='groups.0.fields.0.options.1.order']")[0]; - - expect(option_1_order).not.toBeUndefined(); - - }); - - }); - - describe("Option none", function() { - - it("should have a none attribute with value True", function() { - - jasmine.getFixtures().fixturesPath = "fixtures/"; - loadFixtures("container.html"); - - var option_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_mustache_template); - - Mustache.tags = ['[[', ']]']; - - // Preparing mustache TEMPLATES - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - factoryOption("1", {none: 'True'}, container, "0", "0"); - - options = container.children(); - option_1_none = options.find( - "[name='groups.0.fields.0.options.1.none']")[0]; - - expect(option_1_none).not.toBeUndefined(); - expect($(option_1_none).val()).toBe('True'); - - }); - - }); - - describe("TextInput widget type options", function() { - - it("option widget has an order", function() { - - jasmine.getFixtures().fixturesPath = "fixtures/"; - loadFixtures("container.html"); - - var option_default_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option_default.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_default_mustache_template); - - Mustache.tags = ['[[', ']]']; - - // Preparing mustache TEMPLATES - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - factoryField("0", {"container": container, "widget_type": "TextInput"}); - - var field_widget = container.children(); - - factoryOptionDefault("0", field_widget, "1", ""); - - options = container.children(); - - option_1_order = options.find( - "[name='groups.0.fields.0.options.1.order']")[0]; - - expect(option_1_order).not.toBeUndefined(); - - expect($(option_1_order).val()).toBe("0"); - - }); - - }); - - describe("Image thumbnail widget type options", function() { - - it("option widget has an order", function() { - - jasmine.getFixtures().fixturesPath = "fixtures/"; - loadFixtures("container.html"); - - var option_image_thumbnail_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option_image_thumbnail.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_image_thumbnail_mustache_template); - - Mustache.tags = ['[[', ']]']; - - // Preparing mustache TEMPLATES - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - factoryField("0", {"container": container, "widget_type": "ImageCheckBox"}); - - var field_widget = container.children(); - - jQuery.fn.popover = function(){}; - - factoryImageOptionThumbnail("1", {}, container, "0", "0", "0"); - - options = container.children(); - - option_1_order = options.find( - "[name='groups.0.fields.0.options.1.order']")[0]; - - expect(option_1_order).not.toBeUndefined(); - - expect($(option_1_order).val()).toBe("0"); - - }); - - }); - - describe("Image upload widget type options", function() { - - beforeEach(function() { - - jasmine.getFixtures().fixturesPath = "fixtures/"; - loadFixtures("container.html"); - - var option_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_mustache_template); - - var option_image_upload_mustache_template = $.ajax({ - type: "GET", - url: '/jasmine/mustache_templates/option_image_upload.html', - cache: false, - async: false - }).responseText; - $("#jasmine-fixtures").append(option_image_upload_mustache_template); - - Mustache.tags = ['[[', ']]']; - - // Preparing mustache TEMPLATES - $('script[type="text/x-mustache-template"]').each(function(i, obj){ - TEMPLATES[$(obj).attr('name')] = $(obj).text(); - }); - - }); - - it("option widget has an order", function() { - - factoryImageOptionUpload("1", {}, container, "0", "0", "0"); - - options = container.children(); - - option_1_order = options.find( - "[name='groups.0.fields.0.options.1.order']")[0]; - - expect(option_1_order).not.toBeUndefined(); - - expect($(option_1_order).val()).toBe("0"); - - }); - - }); - - }); - });
\ No newline at end of file |