kiteditor 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/POST_INSTALL +21 -0
- data/{vendor → app}/assets/images/mercury/button.png +0 -0
- data/{vendor → app}/assets/images/mercury/close.png +0 -0
- data/app/assets/images/mercury/default-snippet.png +0 -0
- data/{vendor → app}/assets/images/mercury/loading-dark.gif +0 -0
- data/{vendor → app}/assets/images/mercury/loading-light.gif +0 -0
- data/{vendor → app}/assets/images/mercury/missing-image.png +0 -0
- data/{vendor → app}/assets/images/mercury/search-icon.png +0 -0
- data/{vendor → app}/assets/images/mercury/temp-logo.png +0 -0
- data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/action.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/tools.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
- data/app/assets/images/mercury/toolbar/primary/user.png +0 -0
- data/app/assets/images/mercury/toolbar/snippets/buttons.png +0 -0
- data/{vendor/assets/javascripts/mercury/dependencies → app/assets/javascripts}/jquery-1.7.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury.js +60 -87
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.additions.js +103 -13
- data/{vendor → app}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialog.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/finalize.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/lightview.js.coffee +38 -17
- data/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +201 -0
- data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +208 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/de.locale.js.coffee +4 -10
- data/{vendor → app}/assets/javascripts/mercury/locales/es.locale.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/example.local.js.coffee +3 -5
- data/{vendor → app}/assets/javascripts/mercury/locales/fr.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +209 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/it.locale.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/ko.local.js.coffee +4 -10
- data/{vendor → app}/assets/javascripts/mercury/locales/nl.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +213 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/pt.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +200 -0
- data/{vendor → app}/assets/javascripts/mercury/locales/sv.local.js.coffee +3 -9
- data/{vendor → app}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +3 -9
- data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +200 -0
- data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +203 -0
- data/app/assets/javascripts/mercury/mercury-compiled.js +10720 -0
- data/{vendor → app}/assets/javascripts/mercury/mercury.js.coffee +10 -1
- data/{vendor → app}/assets/javascripts/mercury/modal.js.coffee +62 -40
- data/{vendor → app}/assets/javascripts/mercury/modals/htmleditor.js.coffee +1 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +1 -0
- data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +152 -0
- data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +132 -0
- data/{vendor → app}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -0
- data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +68 -0
- data/{vendor → app}/assets/javascripts/mercury/native_extensions.js.coffee +0 -6
- data/{vendor → app}/assets/javascripts/mercury/page_editor.js.coffee +84 -50
- data/{vendor → app}/assets/javascripts/mercury/palette.js.coffee +1 -1
- data/{vendor → app}/assets/javascripts/mercury/panel.js.coffee +3 -2
- data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/region.js.coffee +18 -17
- data/{vendor/assets/javascripts/mercury/regions/editable.js.coffee → app/assets/javascripts/mercury/regions/full.js.coffee} +41 -31
- data/app/assets/javascripts/mercury/regions/image.js.coffee +93 -0
- data/{vendor/assets/javascripts/mercury/regions/markupable.js.coffee → app/assets/javascripts/mercury/regions/markdown.js.coffee} +29 -24
- data/{vendor → app}/assets/javascripts/mercury/regions/simple.js.coffee +11 -54
- data/{vendor/assets/javascripts/mercury/regions/snippetable.js.coffee → app/assets/javascripts/mercury/regions/snippets.js.coffee} +10 -9
- data/{vendor → app}/assets/javascripts/mercury/select.js.coffee +1 -1
- data/app/assets/javascripts/mercury/snippet.js.coffee +136 -0
- data/{vendor → app}/assets/javascripts/mercury/snippet_toolbar.js.coffee +19 -6
- data/{vendor → app}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/support/history.js +0 -0
- data/{vendor → app}/assets/javascripts/mercury/table_editor.js.coffee +16 -0
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button.js.coffee +45 -30
- data/{vendor → app}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
- data/{vendor → app}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
- data/{vendor → app}/assets/javascripts/mercury/toolbar.js.coffee +10 -6
- data/{vendor → app}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
- data/{vendor → app}/assets/javascripts/mercury/uploader.js.coffee +37 -19
- data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +61 -0
- data/app/assets/stylesheets/_mercury-sass.scss +33 -0
- data/{vendor → app}/assets/stylesheets/mercury.css +1 -5
- data/{vendor → app}/assets/stylesheets/mercury/all_images.css.erb +6 -2
- data/app/assets/stylesheets/mercury/bootstrap-ish.css +1367 -0
- data/app/assets/stylesheets/mercury/bootstrap-overrides.css +61 -0
- data/{vendor → app}/assets/stylesheets/mercury/dialog.css +21 -8
- data/{vendor → app}/assets/stylesheets/mercury/lightview.css +6 -56
- data/app/assets/stylesheets/mercury/mercury.css +43 -0
- data/{vendor → app}/assets/stylesheets/mercury/modal.css +15 -32
- data/{vendor → app}/assets/stylesheets/mercury/statusbar.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/toolbar.css +4 -1
- data/{vendor → app}/assets/stylesheets/mercury/tooltip.css +0 -0
- data/{vendor → app}/assets/stylesheets/mercury/uploader.css +4 -4
- data/app/helpers/mercury_helper.rb +7 -0
- data/app/views/layouts/mercury.html.erb +10 -20
- data/app/views/layouts/mercury.html.haml +19 -0
- data/app/views/layouts/mercury.html.slim +19 -0
- data/app/views/mercury/modals/character.html +1 -1
- data/app/views/mercury/modals/htmleditor.html +3 -7
- data/app/views/mercury/modals/link.html +37 -51
- data/app/views/mercury/modals/media.html +102 -0
- data/app/views/mercury/modals/table.html +79 -73
- data/app/views/mercury/panels/snippets.html +6 -1
- data/app/views/mercury/snippets/example/options.html.erb +23 -27
- data/app/views/mercury/snippets/no_options/preview.html.erb +1 -0
- data/config/routes.rb +9 -0
- data/features/generators/authentication.feature +10 -0
- data/features/generators/images.feature +41 -0
- data/features/generators/install.feature +21 -0
- data/features/loading/loading.feature +5 -2
- data/features/loading/user_interface.feature +9 -7
- data/features/regions/{editable → full}/advanced_editing.feature +0 -0
- data/features/regions/full/basic_editing.feature +198 -0
- data/features/regions/{editable → full}/inserting_links.feature +20 -19
- data/features/regions/{editable → full}/inserting_media.feature +36 -18
- data/features/regions/{editable → full}/inserting_snippets.feature +28 -18
- data/features/regions/{editable → full}/inserting_special_characters.feature +2 -2
- data/features/regions/full/inserting_tables.feature +109 -0
- data/features/regions/{editable → full}/pasting.feature +0 -0
- data/features/regions/{editable → full}/uploading_images.feature +0 -0
- data/features/regions/{markupable → image}/uploading_images.feature +0 -0
- data/features/regions/{markupable → markdown}/advanced_editing.feature +0 -0
- data/features/regions/{markupable → markdown}/basic_editing.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_links.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_media.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_snippets.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_special_characters.feature +0 -0
- data/features/regions/{markupable → markdown}/inserting_tables.feature +0 -0
- data/features/regions/{snippetable/advanced_editing.feature → markdown/uploading_images.feature} +0 -0
- data/features/regions/simple/basic_editing.feature +5 -0
- data/features/regions/{snippetable/basic_editing.feature → snippets/advanced_editing.feature} +0 -0
- data/features/regions/{snippetable/inserting_snippets.feature → snippets/basic_editing.feature} +0 -0
- data/{vendor/assets/javascripts/mercury/locales/da.locale.js.coffee → features/regions/snippets/inserting_snippets.feature} +0 -0
- data/features/saving/saving.feature +8 -8
- data/features/step_definitions/custom_web_steps.rb +22 -0
- data/features/step_definitions/generator_steps.rb +23 -0
- data/features/step_definitions/mercury_steps.rb +1 -438
- data/features/support/aruba.rb +28 -0
- data/features/support/env.rb +11 -1
- data/features/support/selectors.rb +23 -0
- data/lib/generators/mercury/install/authentication/authentication_generator.rb +17 -0
- data/lib/generators/mercury/install/images/images_generator.rb +47 -0
- data/{app/models/mercury/image.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image.rb} +7 -0
- data/{db/migrate/20110526035601_create_mercury_images.rb → lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb} +0 -0
- data/{app/controllers/mercury → lib/generators/mercury/install/images/templates}/images_controller.rb +0 -0
- data/lib/generators/mercury/install/{templates → images/templates}/mongoid_paperclip_image.rb +0 -0
- data/lib/generators/mercury/install/install_generator.rb +12 -23
- data/lib/mercury-rails.rb +1 -2
- data/lib/mercury/authentication.rb +1 -0
- data/lib/mercury/cucumber/step_definitions.rb +13 -0
- data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +408 -0
- data/{features → lib/mercury/cucumber}/support/mercury_contents.rb +3 -3
- data/{features → lib/mercury/cucumber}/support/mercury_selectors.rb +0 -20
- data/lib/mercury/engine.rb +19 -0
- data/lib/mercury/rails.rb +5 -0
- data/lib/mercury/version.rb +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/prototype.js +6082 -0
- data/spec/dummy/app/assets/stylesheets/application.css.scss +110 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mercury.html.erb +28 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +58 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/teabag.rb +9 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/blank.html +1 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/images/bunny.gif +0 -0
- data/spec/dummy/public/images/bunny2.jpg +0 -0
- data/spec/dummy/public/index.html +279 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialog.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/backcolor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/forecolor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/formatblock.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/snippetpanel.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/dialogs/style.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/lightview.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modal.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/htmleditor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/insertcharacter.html +0 -0
- data/spec/javascripts/fixtures/mercury/modals/insertlink.html +67 -0
- data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +87 -0
- data/spec/javascripts/{templates → fixtures}/mercury/modals/insertsnippet.html +0 -0
- data/spec/javascripts/fixtures/mercury/modals/inserttable.html +73 -0
- data/spec/javascripts/{templates → fixtures}/mercury/page_editor.html +4 -4
- data/spec/javascripts/{templates → fixtures}/mercury/palette.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/panel.html +0 -0
- data/spec/javascripts/fixtures/mercury/region.html +6 -0
- data/spec/javascripts/fixtures/mercury/regions/full.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/image.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/markdown.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/simple.html +1 -0
- data/spec/javascripts/fixtures/mercury/regions/snippets.html +4 -0
- data/spec/javascripts/{templates → fixtures}/mercury/select.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/snippet.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/snippet_toolbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/statusbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/table_editor.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.button_group.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.expander.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/toolbar.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/tooltip.html +0 -0
- data/spec/javascripts/{templates → fixtures}/mercury/uploader.html +0 -0
- data/spec/javascripts/mercury/{dialog_spec.js.coffee → dialog_spec.coffee} +11 -12
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -4
- data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/lightview_spec.js.coffee +180 -142
- data/spec/javascripts/mercury/mercury_spec.js.coffee +19 -13
- data/spec/javascripts/mercury/modal_spec.js.coffee +192 -148
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +107 -34
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +106 -26
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +2 -3
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +50 -40
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +124 -80
- data/spec/javascripts/mercury/palette_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/panel_spec.js.coffee +9 -12
- data/spec/javascripts/mercury/region_spec.js.coffee +22 -17
- data/spec/javascripts/mercury/regions/{editable_spec.js.coffee → full_spec.js.coffee} +26 -28
- data/spec/javascripts/mercury/regions/image_spec.js.coffee +33 -0
- data/spec/javascripts/mercury/regions/{markupable_spec.js.coffee → markdown_spec.js.coffee} +32 -34
- data/spec/javascripts/mercury/regions/simple_spec.js.coffee +32 -0
- data/spec/javascripts/mercury/regions/{snippetable_spec.js.coffee → snippets_spec.js.coffee} +54 -55
- data/spec/javascripts/mercury/select_spec.js.coffee +4 -5
- data/spec/javascripts/mercury/snippet_spec.js.coffee +92 -16
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +31 -16
- data/spec/javascripts/mercury/statusbar_spec.js.coffee +9 -10
- data/spec/javascripts/mercury/table_editor_spec.js.coffee +1 -2
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +7 -9
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +55 -26
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
- data/spec/javascripts/mercury/toolbar_spec.js.coffee +43 -14
- data/spec/javascripts/mercury/tooltip_spec.js.coffee +1 -2
- data/spec/javascripts/mercury/uploader_spec.js.coffee +47 -33
- data/spec/javascripts/spec_helper.coffee +4 -0
- data/spec/javascripts/{spec_helper.js → support/event_simulation.js} +0 -2
- data/spec/teabag_env.rb +32 -0
- metadata +366 -196
- data/features/regions/editable/basic_editing.feature +0 -195
- data/features/regions/editable/inserting_tables.feature +0 -109
- data/spec/javascripts/templates/mercury/modals/insertlink.html +0 -30
- data/spec/javascripts/templates/mercury/modals/insertmedia.html +0 -35
- data/spec/javascripts/templates/mercury/modals/inserttable.html +0 -27
- data/spec/javascripts/templates/mercury/region.html +0 -2
- data/spec/javascripts/templates/mercury/regions/editable.html +0 -3
- data/spec/javascripts/templates/mercury/regions/snippetable.html +0 -4
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -54
- data/vendor/assets/javascripts/mercury_loader.js +0 -193
- data/vendor/assets/javascripts/mercury_overrides.js +0 -6
- data/vendor/assets/stylesheets/mercury/mercury.css +0 -151
- data/vendor/assets/stylesheets/mercury_overrides.css +0 -17
@@ -1,10 +1,9 @@
|
|
1
1
|
describe "Mercury.modalHandlers.htmlEditor", ->
|
2
2
|
|
3
|
-
template 'mercury/modals/htmleditor.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
4
|
+
fixture.load('mercury/modals/htmleditor.html')
|
6
5
|
@modal =
|
7
|
-
element: $(
|
6
|
+
element: $(fixture.el)
|
8
7
|
hide: ->
|
9
8
|
Mercury.region =
|
10
9
|
content: -> '<span>html \ncontent</span>'
|
@@ -13,7 +12,7 @@ describe "Mercury.modalHandlers.htmlEditor", ->
|
|
13
12
|
describe "loading", ->
|
14
13
|
|
15
14
|
it "sets the value of the textarea", ->
|
16
|
-
expect($('
|
15
|
+
expect($('textarea', fixture.el).val()).toEqual('<span>html \ncontent</span>')
|
17
16
|
|
18
17
|
|
19
18
|
describe "submitting", ->
|
@@ -22,7 +21,7 @@ describe "Mercury.modalHandlers.htmlEditor", ->
|
|
22
21
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
23
22
|
jasmine.simulate.click($('#submit').get(0))
|
24
23
|
expect(spy.callCount).toEqual(1)
|
25
|
-
expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html
|
24
|
+
expect(spy.argsForCall[0]).toEqual(['action', {action: 'replaceHTML', value: '<span>html \ncontent</span>'}])
|
26
25
|
|
27
26
|
it "hides the modal", ->
|
28
27
|
spy = spyOn(@modal, 'hide').andCallFake(=>)
|
@@ -1,10 +1,9 @@
|
|
1
1
|
describe "Mercury.modalHandlers.insertCharacter", ->
|
2
2
|
|
3
|
-
template 'mercury/modals/insertcharacter.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
4
|
+
fixture.load('mercury/modals/insertcharacter.html')
|
6
5
|
@modal =
|
7
|
-
element: $(
|
6
|
+
element: $(fixture.el)
|
8
7
|
hide: ->
|
9
8
|
@modalHideSpy = spyOn(@modal, 'hide').andCallFake(=>)
|
10
9
|
Mercury.modalHandlers.insertCharacter.call(@modal)
|
@@ -1,19 +1,19 @@
|
|
1
1
|
describe "Mercury.modalHandlers.insertLink", ->
|
2
2
|
|
3
|
-
template 'mercury/modals/insertlink.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
4
|
+
fixture.load('mercury/modals/insertlink.html')
|
6
5
|
Mercury.region = null
|
7
6
|
@modal =
|
8
|
-
element: $(
|
7
|
+
element: $(fixture.el)
|
9
8
|
hide: ->
|
10
9
|
resize: ->
|
10
|
+
@insertLink = $.extend(@modal, Mercury.modalHandlers.insertLink)
|
11
11
|
window.mercuryInstance = {document: $(document)}
|
12
12
|
|
13
13
|
describe "initializing", ->
|
14
14
|
|
15
15
|
beforeEach ->
|
16
|
-
|
16
|
+
@insertLink.initialize()
|
17
17
|
|
18
18
|
it "loads all links with a name into the existing bookmarks pulldown", ->
|
19
19
|
options = $('#link_existing_bookmark').html()
|
@@ -25,28 +25,35 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
25
25
|
describe "clicking on a radio button (in a label)", ->
|
26
26
|
|
27
27
|
beforeEach ->
|
28
|
-
|
28
|
+
@insertLink.initialize()
|
29
29
|
|
30
30
|
it "focuses the next input with a selectable class", ->
|
31
31
|
spy = spyOn($.fn, 'focus').andCallFake(=>)
|
32
|
-
jasmine.simulate.click($('
|
32
|
+
jasmine.simulate.click($('input[value=external_url]').get(0))
|
33
33
|
expect(spy.callCount).toEqual(1)
|
34
34
|
|
35
35
|
|
36
36
|
describe "focusing an input", ->
|
37
37
|
|
38
38
|
beforeEach ->
|
39
|
-
|
39
|
+
@insertLink.initialize()
|
40
40
|
|
41
41
|
it "checks the corresponding checkbox", ->
|
42
42
|
$('#link_existing_bookmark').focus()
|
43
|
-
expect($('
|
43
|
+
expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
|
44
44
|
|
45
45
|
|
46
46
|
describe "changing the link target", ->
|
47
47
|
|
48
48
|
it "shows options for whatever was selected", ->
|
49
|
+
$('#link_target').val('popup')
|
50
|
+
@insertLink.onChangeTarget()
|
51
|
+
expect($('#popup_options').is(':visible')).toEqual(true)
|
52
|
+
|
49
53
|
it "calls resize", ->
|
54
|
+
spy = spyOn(@modal, 'resize')
|
55
|
+
@insertLink.onChangeTarget()
|
56
|
+
expect(spy.callCount).toEqual(1)
|
50
57
|
|
51
58
|
|
52
59
|
describe "when editing", ->
|
@@ -56,12 +63,11 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
56
63
|
beforeEach ->
|
57
64
|
Mercury.region = selection: => {
|
58
65
|
commonAncestor: -> $('<a>', {href: 'http://cnn.com', target: '_top'}).html('foo'),
|
59
|
-
|
60
|
-
|
61
|
-
Mercury.modalHandlers.insertLink.call(@modal)
|
66
|
+
}
|
67
|
+
@insertLink.initialize()
|
62
68
|
|
63
69
|
it "hides the link text input", ->
|
64
|
-
expect($('#link_text_container').
|
70
|
+
expect($('#link_text_container').is(':visible')).toEqual(false)
|
65
71
|
|
66
72
|
it "pre-fills the link url input", ->
|
67
73
|
expect($('#link_external_url').val()).toEqual('http://cnn.com')
|
@@ -69,17 +75,16 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
69
75
|
it "selects the target if one's available", ->
|
70
76
|
expect($('#link_target').val()).toEqual('_top')
|
71
77
|
|
72
|
-
it "fills the content", ->
|
73
|
-
expect($('#link_text').val()).toEqual('content')
|
74
|
-
|
75
78
|
describe "a javascript popup link", ->
|
76
79
|
|
77
80
|
beforeEach ->
|
78
|
-
Mercury.region = selection: => {
|
79
|
-
|
81
|
+
Mercury.region = selection: => {
|
82
|
+
commonAncestor: -> $('<a>', {href: "javascript:void(window.open('http://cnn.com', 'popup_window', 'width=100,height=42,menubar=no,toolbar=no'))"}).html('foo')
|
83
|
+
}
|
84
|
+
@insertLink.initialize()
|
80
85
|
|
81
86
|
it "hides the link text input", ->
|
82
|
-
expect($('#link_text_container').
|
87
|
+
expect($('#link_text_container').is(':visible')).toEqual(false)
|
83
88
|
|
84
89
|
it "pre-fills the link url input", ->
|
85
90
|
expect($('#link_external_url').val()).toEqual('http://cnn.com')
|
@@ -94,11 +99,13 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
94
99
|
describe "a bookmark link", ->
|
95
100
|
|
96
101
|
beforeEach ->
|
97
|
-
Mercury.region = selection: => {
|
98
|
-
|
102
|
+
Mercury.region = selection: => {
|
103
|
+
commonAncestor: -> $('<a>', {href: '#link2'}).html('foo')
|
104
|
+
}
|
105
|
+
@insertLink.initialize()
|
99
106
|
|
100
107
|
it "hides the link text input", ->
|
101
|
-
expect($('#link_text_container').
|
108
|
+
expect($('#link_text_container').is(':visible')).toEqual(false)
|
102
109
|
|
103
110
|
it "checks the existing bookmark radio", ->
|
104
111
|
expect($('input[value=existing_bookmark]').get(0).checked).toEqual(true)
|
@@ -109,8 +116,10 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
109
116
|
describe "a bookmark target", ->
|
110
117
|
|
111
118
|
beforeEach ->
|
112
|
-
Mercury.region = selection: => {
|
113
|
-
|
119
|
+
Mercury.region = selection: => {
|
120
|
+
commonAncestor: -> $('<a>', {name: 'link3'}).html('foo')
|
121
|
+
}
|
122
|
+
@insertLink.initialize()
|
114
123
|
|
115
124
|
it "hides the link text input", ->
|
116
125
|
expect($('#link_text_container').css('display')).toEqual('none')
|
@@ -122,18 +131,80 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
122
131
|
expect($('#link_new_bookmark').val()).toEqual('link3')
|
123
132
|
|
124
133
|
|
134
|
+
describe "validating", ->
|
135
|
+
|
136
|
+
beforeEach ->
|
137
|
+
@insertLink.initialize()
|
138
|
+
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
139
|
+
$('#link_text').val('foo')
|
140
|
+
|
141
|
+
it "displays an error if there's no content", ->
|
142
|
+
$('#link_text').val('')
|
143
|
+
@insertLink.validateForm()
|
144
|
+
expect(@insertLink.valid).toEqual(false)
|
145
|
+
expect($('#link_text').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
|
146
|
+
|
147
|
+
describe "a standard link", ->
|
148
|
+
|
149
|
+
it "displays an error", ->
|
150
|
+
@insertLink.validateForm()
|
151
|
+
expect(@insertLink.valid).toEqual(false)
|
152
|
+
expect($('#link_external_url').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
|
153
|
+
|
154
|
+
it "doesn't submit", ->
|
155
|
+
@insertLink.validateForm()
|
156
|
+
expect(@triggerSpy.callCount).toEqual(0)
|
157
|
+
|
158
|
+
describe "a bookmark link", ->
|
159
|
+
|
160
|
+
beforeEach ->
|
161
|
+
jasmine.simulate.click($('input[value=existing_bookmark]').get(0))
|
162
|
+
$('#link_existing_bookmark').html('').val('')
|
163
|
+
|
164
|
+
it "displays an error", ->
|
165
|
+
@insertLink.validateForm()
|
166
|
+
expect(@insertLink.valid).toEqual(false)
|
167
|
+
expect($('#link_existing_bookmark').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
|
168
|
+
|
169
|
+
it "doesn't submit", ->
|
170
|
+
@insertLink.validateForm()
|
171
|
+
expect(@triggerSpy.callCount).toEqual(0)
|
172
|
+
|
173
|
+
describe "a bookmark target", ->
|
174
|
+
|
175
|
+
beforeEach ->
|
176
|
+
jasmine.simulate.click($('input[value=new_bookmark]').get(0))
|
177
|
+
|
178
|
+
it "displays an error", ->
|
179
|
+
@insertLink.validateForm()
|
180
|
+
expect(@insertLink.valid).toEqual(false)
|
181
|
+
expect($('#link_new_bookmark').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
|
182
|
+
|
183
|
+
it "doesn't submit", ->
|
184
|
+
@insertLink.validateForm()
|
185
|
+
expect(@triggerSpy.callCount).toEqual(0)
|
186
|
+
|
187
|
+
|
125
188
|
describe "submitting", ->
|
126
189
|
|
127
190
|
describe "a new link", ->
|
128
191
|
|
129
192
|
beforeEach ->
|
130
|
-
|
193
|
+
@insertLink.initialize()
|
131
194
|
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
132
195
|
$('#link_text').val('foo')
|
133
196
|
|
197
|
+
it "doesn't submit unless it's valid", ->
|
198
|
+
$('#link_text').val('')
|
199
|
+
spy = spyOn(@modal, 'hide')
|
200
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
201
|
+
expect(spy.callCount).toEqual(0)
|
202
|
+
expect(@insertLink.valid).toEqual(false)
|
203
|
+
|
134
204
|
it "hides the modal", ->
|
135
|
-
|
136
|
-
|
205
|
+
$('#link_external_url').val('http://cnn.com')
|
206
|
+
spy = spyOn(@modal, 'hide')
|
207
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
137
208
|
expect(spy.callCount).toEqual(1)
|
138
209
|
|
139
210
|
describe "as a standard link", ->
|
@@ -143,7 +214,7 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
143
214
|
$('#link_target').val('_top')
|
144
215
|
|
145
216
|
it "triggers an action with the proper values", ->
|
146
|
-
jasmine.simulate.click($('
|
217
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
147
218
|
expect(@triggerSpy.callCount).toEqual(1)
|
148
219
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
149
220
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
|
@@ -158,7 +229,7 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
158
229
|
$('#link_popup_height').val('42')
|
159
230
|
|
160
231
|
it "triggers an action with the proper values", ->
|
161
|
-
jasmine.simulate.click($('
|
232
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
162
233
|
expect(@triggerSpy.callCount).toEqual(1)
|
163
234
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
164
235
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
|
@@ -171,7 +242,7 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
171
242
|
$('input[value=existing_bookmark]').prop('checked', true)
|
172
243
|
|
173
244
|
it "triggers an action with the proper values", ->
|
174
|
-
jasmine.simulate.click($('
|
245
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
175
246
|
expect(@triggerSpy.callCount).toEqual(1)
|
176
247
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
177
248
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
|
@@ -184,7 +255,7 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
184
255
|
$('input[value=new_bookmark]').prop('checked', true)
|
185
256
|
|
186
257
|
it "triggers an action with the proper values", ->
|
187
|
-
jasmine.simulate.click($('
|
258
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
188
259
|
expect(@triggerSpy.callCount).toEqual(1)
|
189
260
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
190
261
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertLink')
|
@@ -194,14 +265,16 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
194
265
|
|
195
266
|
beforeEach ->
|
196
267
|
@existingLink = $('<a>', {name: 'link3'}).html('foo')
|
197
|
-
Mercury.region = selection: => {
|
198
|
-
|
268
|
+
Mercury.region = selection: => {
|
269
|
+
commonAncestor: => @existingLink
|
270
|
+
}
|
271
|
+
@insertLink.initialize()
|
199
272
|
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
200
273
|
$('#link_text').val('foo')
|
201
274
|
|
202
275
|
it "hides the modal", ->
|
203
276
|
spy = spyOn(@modal, 'hide').andCallFake(=>)
|
204
|
-
jasmine.simulate.click($('
|
277
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
205
278
|
expect(spy.callCount).toEqual(1)
|
206
279
|
|
207
280
|
describe "as a standard link", ->
|
@@ -212,7 +285,7 @@ describe "Mercury.modalHandlers.insertLink", ->
|
|
212
285
|
$('input[value=external_url]').prop('checked', true)
|
213
286
|
|
214
287
|
it "triggers an action with the proper values", ->
|
215
|
-
jasmine.simulate.click($('
|
288
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
216
289
|
expect(@triggerSpy.callCount).toEqual(1)
|
217
290
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
218
291
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('replaceLink')
|
@@ -1,43 +1,44 @@
|
|
1
1
|
describe "Mercury.modalHandlers.insertMedia", ->
|
2
2
|
|
3
|
-
template 'mercury/modals/insertmedia.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
4
|
+
fixture.load('mercury/modals/insertmedia.html')
|
6
5
|
Mercury.region = null
|
7
|
-
spyOn(window, 'setTimeout').andCallFake((
|
6
|
+
spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
|
8
7
|
@modal =
|
9
|
-
element: $(
|
8
|
+
element: $(fixture.el)
|
10
9
|
hide: ->
|
11
10
|
resize: ->
|
11
|
+
@insertMedia = $.extend(@modal, Mercury.modalHandlers.insertMedia)
|
12
|
+
window.mercuryInstance = {document: $(document)}
|
12
13
|
|
13
14
|
describe "clicking on a radio button (in a label)", ->
|
14
15
|
|
15
16
|
beforeEach ->
|
16
|
-
|
17
|
+
@insertMedia.initialize()
|
17
18
|
|
18
19
|
it "focuses the next input with a selectable class", ->
|
19
20
|
spy = spyOn($.fn, 'focus').andCallFake(=>)
|
20
|
-
jasmine.simulate.click($('
|
21
|
+
jasmine.simulate.click($('input[value=image_url]').get(0))
|
21
22
|
expect(spy.callCount).toEqual(1)
|
22
23
|
|
23
24
|
|
24
25
|
describe "focusing an input", ->
|
25
26
|
|
26
27
|
beforeEach ->
|
27
|
-
|
28
|
+
@insertMedia.initialize()
|
28
29
|
|
29
30
|
it "checks the corresponding checkbox", ->
|
30
31
|
$('#media_youtube_url').focus()
|
31
|
-
expect($('
|
32
|
+
expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
|
32
33
|
|
33
34
|
it "hides all the option divs", ->
|
34
35
|
$('#media_youtube_url').focus()
|
35
|
-
expect($('#
|
36
|
-
expect($('#
|
36
|
+
expect($('#image_url_options').css('display')).toEqual('none')
|
37
|
+
expect($('#vimeo_url_options').css('display')).toEqual('none')
|
37
38
|
|
38
39
|
it "shows the options for the item that was focused", ->
|
39
40
|
$('#media_youtube_url').focus()
|
40
|
-
expect($('#
|
41
|
+
expect($('#youtube_url_options').css('display')).toNotEqual('none')
|
41
42
|
|
42
43
|
it "calls resize", ->
|
43
44
|
spy = spyOn(@modal, 'resize').andCallFake(=>)
|
@@ -51,30 +52,33 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
51
52
|
|
52
53
|
beforeEach ->
|
53
54
|
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
|
54
|
-
@selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right'})}
|
55
|
+
@selection = {is: -> $('<img>', {src: '/foo.gif', align: 'right', style: 'float: left;'})}
|
55
56
|
Mercury.region = selection: => @selection
|
56
|
-
|
57
|
+
@insertMedia.initialize()
|
57
58
|
|
58
59
|
it "pre-fills the image url", ->
|
59
60
|
expect($('#media_image_url').val()).toEqual('/foo.gif')
|
60
61
|
|
61
62
|
it "focuses the url input", ->
|
62
|
-
expect(@focusSpy.callCount).toEqual(
|
63
|
+
expect(@focusSpy.callCount).toEqual(2)
|
63
64
|
expect($('input[value=image_url]').get(0).checked).toEqual(true)
|
64
65
|
|
65
66
|
it "sets the image alignment option", ->
|
66
67
|
expect($('#media_image_alignment').val()).toEqual('right')
|
67
68
|
|
69
|
+
it "sets the image float option", ->
|
70
|
+
expect($('#media_image_float').val()).toEqual('left')
|
71
|
+
|
68
72
|
describe "an existing youtube video", ->
|
69
73
|
|
70
74
|
beforeEach ->
|
71
75
|
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
|
72
|
-
@selection = {is: -> $('<iframe>', {src: '
|
76
|
+
@selection = {is: -> $('<iframe>', {src: 'https://www.youtube.com/embed/foo?wmode=transparent', style: 'width:100px;height:42px'})}
|
73
77
|
Mercury.region = selection: => @selection
|
74
|
-
|
78
|
+
@insertMedia.initialize()
|
75
79
|
|
76
80
|
it "pre-fills the url", ->
|
77
|
-
expect($('#media_youtube_url').val()).toEqual('
|
81
|
+
expect($('#media_youtube_url').val()).toEqual('https://youtu.be/foo')
|
78
82
|
|
79
83
|
it "focuses the url input", ->
|
80
84
|
expect($('input[value=youtube_url]').get(0).checked).toEqual(true)
|
@@ -91,7 +95,7 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
91
95
|
@focusSpy = spyOn($.fn, 'focus').andCallThrough()
|
92
96
|
@selection = {is: -> $('<iframe>', {src: 'http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff', style: 'width:100px;height:42px'})}
|
93
97
|
Mercury.region = selection: => @selection
|
94
|
-
|
98
|
+
@insertMedia.initialize()
|
95
99
|
|
96
100
|
it "pre-fills the url", ->
|
97
101
|
expect($('#media_vimeo_url').val()).toEqual('http://vimeo.com/foo')
|
@@ -106,15 +110,67 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
106
110
|
expect($('#media_vimeo_height').val()).toEqual('42')
|
107
111
|
|
108
112
|
|
113
|
+
describe "validating", ->
|
114
|
+
|
115
|
+
beforeEach ->
|
116
|
+
@insertMedia.initialize()
|
117
|
+
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
118
|
+
|
119
|
+
describe "an image", ->
|
120
|
+
|
121
|
+
it "displays an error", ->
|
122
|
+
@insertMedia.validateForm()
|
123
|
+
expect(@insertMedia.valid).toEqual(false)
|
124
|
+
expect($('#media_image_url').closest('.control-group').find('.error-message').html()).toEqual("can't be blank")
|
125
|
+
|
126
|
+
it "doesn't submit", ->
|
127
|
+
@insertMedia.validateForm()
|
128
|
+
expect(@triggerSpy.callCount).toEqual(0)
|
129
|
+
|
130
|
+
describe "a youtube video", ->
|
131
|
+
|
132
|
+
beforeEach ->
|
133
|
+
$('input[value=youtube_url]').prop('checked', true)
|
134
|
+
|
135
|
+
it "displays an error", ->
|
136
|
+
@insertMedia.validateForm()
|
137
|
+
expect(@insertMedia.valid).toEqual(false)
|
138
|
+
expect($('#media_youtube_url').closest('.control-group').find('.error-message').html()).toEqual("is invalid")
|
139
|
+
|
140
|
+
it "doesn't submit", ->
|
141
|
+
@insertMedia.validateForm()
|
142
|
+
expect(@triggerSpy.callCount).toEqual(0)
|
143
|
+
|
144
|
+
describe "a vimeo video", ->
|
145
|
+
beforeEach ->
|
146
|
+
$('input[value=vimeo_url]').prop('checked', true)
|
147
|
+
|
148
|
+
it "displays an error", ->
|
149
|
+
@insertMedia.validateForm()
|
150
|
+
expect(@insertMedia.valid).toEqual(false)
|
151
|
+
expect($('#media_vimeo_url').closest('.control-group').find('.error-message').html()).toEqual("is invalid")
|
152
|
+
|
153
|
+
it "doesn't submit", ->
|
154
|
+
@insertMedia.validateForm()
|
155
|
+
expect(@triggerSpy.callCount).toEqual(0)
|
156
|
+
|
157
|
+
|
109
158
|
describe "submitting", ->
|
110
159
|
|
111
160
|
beforeEach ->
|
112
|
-
|
161
|
+
@insertMedia.initialize()
|
113
162
|
@triggerSpy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
114
163
|
|
164
|
+
it "doesn't submit unless it's valid", ->
|
165
|
+
spy = spyOn(@modal, 'hide')
|
166
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
167
|
+
expect(spy.callCount).toEqual(0)
|
168
|
+
expect(@insertMedia.valid).toEqual(false)
|
169
|
+
|
115
170
|
it "hides the modal", ->
|
116
|
-
|
117
|
-
|
171
|
+
$('#media_image_url').val('foo.gif')
|
172
|
+
spy = spyOn(@modal, 'hide')
|
173
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
118
174
|
expect(spy.callCount).toEqual(1)
|
119
175
|
|
120
176
|
describe "an image", ->
|
@@ -122,13 +178,14 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
122
178
|
beforeEach ->
|
123
179
|
$('#media_image_url').val('http://domain/foo.gif')
|
124
180
|
$('#media_image_alignment').val('right')
|
181
|
+
$('#media_image_float').val('left')
|
125
182
|
|
126
183
|
it "triggers an action with the proper values", ->
|
127
|
-
jasmine.simulate.click($('
|
184
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
128
185
|
expect(@triggerSpy.callCount).toEqual(1)
|
129
186
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
130
187
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertImage')
|
131
|
-
expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right'})
|
188
|
+
expect(@triggerSpy.argsForCall[0][1]['value']).toEqual({src: 'http://domain/foo.gif', align: 'right', style: 'float: left;'})
|
132
189
|
|
133
190
|
describe "a youtube video", ->
|
134
191
|
|
@@ -139,7 +196,8 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
139
196
|
$('input[value=youtube_url]').prop('checked', true)
|
140
197
|
|
141
198
|
it "triggers an action with the proper values", ->
|
142
|
-
|
199
|
+
$('#media_youtube_url').val('http://youtu.be/foo')
|
200
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
143
201
|
expect(@triggerSpy.callCount).toEqual(1)
|
144
202
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
145
203
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
|
@@ -148,16 +206,27 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
148
206
|
expect(value).toContain('42px')
|
149
207
|
expect(value).toContain('src="http://www.youtube.com/embed/foo?wmode=transparent"')
|
150
208
|
|
209
|
+
it "triggers an action with the proper values using https", ->
|
210
|
+
$('#media_youtube_url').val('https://youtu.be/foo')
|
211
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
212
|
+
expect(@triggerSpy.callCount).toEqual(1)
|
213
|
+
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
214
|
+
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
|
215
|
+
value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
|
216
|
+
expect(value).toContain('100px')
|
217
|
+
expect(value).toContain('42px')
|
218
|
+
expect(value).toContain('src="https://www.youtube.com/embed/foo?wmode=transparent"')
|
219
|
+
|
151
220
|
describe "a vimeo video", ->
|
152
221
|
|
153
222
|
beforeEach ->
|
154
|
-
$('#media_vimeo_url').val('http://vimeo.com/foo')
|
155
223
|
$('#media_vimeo_width').val(100)
|
156
224
|
$('#media_vimeo_height').val('42')
|
157
225
|
$('input[value=vimeo_url]').prop('checked', true)
|
158
226
|
|
159
227
|
it "triggers an action with the proper values", ->
|
160
|
-
|
228
|
+
$('#media_vimeo_url').val('http://vimeo.com/foo')
|
229
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
161
230
|
expect(@triggerSpy.callCount).toEqual(1)
|
162
231
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
163
232
|
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
|
@@ -165,3 +234,14 @@ describe "Mercury.modalHandlers.insertMedia", ->
|
|
165
234
|
expect(value).toContain('100px')
|
166
235
|
expect(value).toContain('42px')
|
167
236
|
expect(value).toContain('http://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff')
|
237
|
+
|
238
|
+
it "triggers an action with the proper values using https", ->
|
239
|
+
$('#media_vimeo_url').val('https://vimeo.com/foo')
|
240
|
+
jasmine.simulate.click($('input[type=submit]').get(0))
|
241
|
+
expect(@triggerSpy.callCount).toEqual(1)
|
242
|
+
expect(@triggerSpy.argsForCall[0][0]).toEqual('action')
|
243
|
+
expect(@triggerSpy.argsForCall[0][1]['action']).toEqual('insertHTML')
|
244
|
+
value = $('<div>').html(@triggerSpy.argsForCall[0][1]['value']).html()
|
245
|
+
expect(value).toContain('100px')
|
246
|
+
expect(value).toContain('42px')
|
247
|
+
expect(value).toContain('https://player.vimeo.com/video/foo?title=1&byline=1&portrait=0&color=ffffff')
|