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
@@ -0,0 +1,87 @@
|
|
1
|
+
<form>
|
2
|
+
|
3
|
+
<div class="control-group url optional">
|
4
|
+
<label class="url optional control-label" for="media_image_url">
|
5
|
+
<input name="media_type" type="radio" value="image_url" checked="checked"/>URL
|
6
|
+
</label>
|
7
|
+
<div class="controls">
|
8
|
+
<input class="string url optional" id="media_image_url" name="media[image_url]" size="50" type="text">
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="control-group url optional">
|
13
|
+
<label class="url optional control-label" for="media_youtube_url">
|
14
|
+
<input name="media_type" type="radio" value="youtube_url"/>Youtube Share URL
|
15
|
+
</label>
|
16
|
+
<div class="controls">
|
17
|
+
<input class="string url optional" id="media_youtube_url" name="media[youtube_url]" size="50" type="text" placeholder="http://youtu.be/Pny4hoN8eII">
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<div class="control-group url optional">
|
21
|
+
<label class="url optional control-label" for="media_vimeo_url">
|
22
|
+
<input name="media_type" type="radio" value="vimeo_url"/>Vimeo URL
|
23
|
+
</label>
|
24
|
+
<div class="controls">
|
25
|
+
<input class="string url optional" id="media_vimeo_url" name="media[vimeo_url]" size="50" type="text" placeholder="http://vimeo.com/25708134">
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="media-options" id="image_url_options">
|
30
|
+
<div class="control-group select optional">
|
31
|
+
<label class="select optional control-label" for="media_image_alignment">Alignment</label>
|
32
|
+
<div class="controls">
|
33
|
+
<select class="select optional" id="media_image_alignment" name="media[image_alignment]">
|
34
|
+
<option value="">None</option>
|
35
|
+
<option value="left">Left</option>
|
36
|
+
<option value="right">Right</option>
|
37
|
+
<option value="top">Top</option>
|
38
|
+
<option value="middle">Middle</option>
|
39
|
+
<option value="bottom">Bottom</option>
|
40
|
+
<option value="absmiddle">Absolute Middle</option>
|
41
|
+
<option value="absbottom">Absolute Bottom</option>
|
42
|
+
</select>
|
43
|
+
</div>
|
44
|
+
<label class="select optional control-label" for="media_image_float">Float</label>
|
45
|
+
<div class="controls">
|
46
|
+
<select class="select optional" id="media_image_float" name="media[image_float]">
|
47
|
+
<option value="">None</option>
|
48
|
+
<option value="left">Left</option>
|
49
|
+
<option value="right">Right</option>
|
50
|
+
<option value="none">None</option>
|
51
|
+
<option value="inherit">Inherit</option>
|
52
|
+
</select>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
<div class="media-options" id="youtube_url_options" style="display:none">
|
57
|
+
<div class="control-group number optional">
|
58
|
+
<label class="number optional control-label" for="media_youtube_width">Width</label>
|
59
|
+
<div class="controls">
|
60
|
+
<input class="number optional" id="media_youtube_width" name="media[youtube_width]" size="50" type="number" value="560">
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
<div class="control-group number optional">
|
64
|
+
<label class="number optional control-label" for="media_youtube_height">Height</label>
|
65
|
+
<div class="controls">
|
66
|
+
<input class="number optional" id="media_youtube_height" name="media[youtube_height]" size="50" type="number" value="349">
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
<div class="media-options" id="vimeo_url_options" style="display:none">
|
71
|
+
<div class="control-group number optional">
|
72
|
+
<label class="number optional control-label" for="media_vimeo_width">Width</label>
|
73
|
+
<div class="controls">
|
74
|
+
<input class="number optional" id="media_vimeo_width" name="media[vimeo_width]" size="50" type="number" value="400">
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<div class="control-group number optional">
|
78
|
+
<label class="number optional control-label" for="media_vimeo_height">Height</label>
|
79
|
+
<div class="controls">
|
80
|
+
<input class="number optional" id="media_vimeo_height" name="media[vimeo_height]" size="50" type="number" value="225">
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<input class="submit" name="commit" type="submit" value="Insert Media"/>
|
86
|
+
|
87
|
+
</form>
|
File without changes
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<form>
|
2
|
+
|
3
|
+
<div id="table_display" class="control-group optional">
|
4
|
+
<div class="controls">
|
5
|
+
<table border="1" cellspacing="0">
|
6
|
+
<tr>
|
7
|
+
<td id="cell1"> </td>
|
8
|
+
</tr>
|
9
|
+
<tr>
|
10
|
+
<td id="cell2"> </td>
|
11
|
+
</tr>
|
12
|
+
</table>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="control-group buttons optional">
|
17
|
+
<label class="buttons optional control-label">Rows</label>
|
18
|
+
<div class="controls btn-group">
|
19
|
+
<button class="btn" data-action="addRowBefore">Add Before</button>
|
20
|
+
<button class="btn" data-action="addRow">Add After</button>
|
21
|
+
<button class="btn" data-action="removeRow">Remove</button>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<div class="control-group buttons optional">
|
25
|
+
<label class="buttons optional control-label">Columns</label>
|
26
|
+
<div class="controls btn-group">
|
27
|
+
<button class="btn" data-action="addColumnBefore">Add Before</button>
|
28
|
+
<button class="btn" data-action="addColumn">Add After</button>
|
29
|
+
<button class="btn" data-action="removeColumn">Remove</button>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<hr/>
|
33
|
+
<div class="control-group buttons optional">
|
34
|
+
<label class="buttons optional control-label">Row Span</label>
|
35
|
+
<div class="controls btn-group">
|
36
|
+
<button class="btn" data-action="increaseRowspan">+</button>
|
37
|
+
<button class="btn" data-action="decreaseRowspan">-</button>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<div class="control-group buttons optional">
|
41
|
+
<label class="buttons optional control-label">Column Span</label>
|
42
|
+
<div class="controls btn-group">
|
43
|
+
<button class="btn" data-action="increaseColspan">+</button>
|
44
|
+
<button class="btn" data-action="decreaseColspan">-</button>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<div class="control-group select optional">
|
49
|
+
<label class="select optional control-label" for="table_alignment">Alignment</label>
|
50
|
+
<div class="controls">
|
51
|
+
<select class="select optional" id="table_alignment" name="table[alignment]">
|
52
|
+
<option value="">None</option>
|
53
|
+
<option value="right">Right</option>
|
54
|
+
<option value="left">Left</option>
|
55
|
+
</select>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<div class="control-group number optional">
|
59
|
+
<label class="number optional control-label" for="table_border">Border</label>
|
60
|
+
<div class="controls">
|
61
|
+
<input class="number optional" id="table_border" name="table[border]" size="50" type="number" value="1">
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
<div class="control-group number optional">
|
65
|
+
<label class="number optional control-label" for="table_spacing">Spacing</label>
|
66
|
+
<div class="controls">
|
67
|
+
<input class="number optional" id="table_spacing" name="table[spacing]" size="50" type="number" value="0">
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<input class="submit" name="commit" type="submit" value="Insert Table"/>
|
72
|
+
|
73
|
+
</form>
|
@@ -7,9 +7,9 @@
|
|
7
7
|
<meta content="K6JhyfOVKJX8X2ZkiJXSf491fc1fF+k79wzrChHQa0g=" name="csrf-token" />
|
8
8
|
|
9
9
|
<div id="page_editor_container"></div>
|
10
|
-
<div id="region1"
|
11
|
-
<div id="region2"
|
12
|
-
<div id="region3"
|
10
|
+
<div id="region1" custom-region-attribute="full"></div>
|
11
|
+
<div id="region2" custom-region-attribute="full"></div>
|
12
|
+
<div id="region3" custom-region-attribute="full">
|
13
13
|
<a id="anchor1r" href="#" target="_top">1</a>
|
14
14
|
<a id="anchor2r" href="#" target="_blank">2</a>
|
15
15
|
<a id="anchor3r" href="#" target="_self">3</a>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<form id="form3r" action="" target="_self"></form>
|
20
20
|
<form id="form4r" action=""></form>
|
21
21
|
</div>
|
22
|
-
<div id="region4"
|
22
|
+
<div id="region4" custom-region-attribute=""></div>
|
23
23
|
|
24
24
|
<a id="anchor1" href="#" target="_top">1</a>
|
25
25
|
<a id="anchor2" href="#" target="_blank">2</a>
|
File without changes
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div id="region" data-scope="scope" data-version="1">contents</div>
|
2
|
+
<div id="region_with_snippet">contents<div class="example-snippet" data-snippet="snippet_1" data-version="1">snippet</div></div>
|
3
|
+
<div id="region_with_javascript_snippet"><div class="example-snippet" data-snippet="snippet_1" data-version="1">
|
4
|
+
<ul id="modifiable-element"></ul>
|
5
|
+
<script>$("#modifiable-element").append("<li />");</script>
|
6
|
+
</div></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div id="full_region1"></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<img id="image_region1" src="foo.jpg" />
|
@@ -0,0 +1 @@
|
|
1
|
+
<div id="markdown_region1"></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div id="simple_region1"></div>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,8 +1,7 @@
|
|
1
1
|
describe "Mercury.Dialog", ->
|
2
2
|
|
3
|
-
template 'mercury/dialog.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
4
|
+
fixture.load('mercury/dialog.html')
|
6
5
|
$.fx.off = true
|
7
6
|
Mercury.determinedLocale =
|
8
7
|
top: {'hello world!': 'bork! bork!'}
|
@@ -49,7 +48,7 @@ describe "Mercury.Dialog", ->
|
|
49
48
|
@preloadSpy = spyOn(Mercury.Dialog.prototype, 'preload').andCallFake(=>)
|
50
49
|
|
51
50
|
it "builds an element", ->
|
52
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
51
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
53
52
|
html = $('<div>').html(@dialog.element).html()
|
54
53
|
expect(html).toContain('class="mercury-dialog mercury-foo-dialog loading"')
|
55
54
|
expect(html).toContain('style="display:none"')
|
@@ -70,18 +69,18 @@ describe "Mercury.Dialog", ->
|
|
70
69
|
@loadSpy = spyOn(Mercury.Dialog.prototype, 'load').andCallFake(=>)
|
71
70
|
|
72
71
|
it "calls load if configured", ->
|
73
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
72
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el, preload: true})
|
74
73
|
expect(@loadSpy.callCount).toEqual(1)
|
75
74
|
|
76
75
|
it "doesn't call load if configured", ->
|
77
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
76
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el, preload: false})
|
78
77
|
expect(@loadSpy.callCount).toEqual(0)
|
79
78
|
|
80
79
|
|
81
80
|
describe "#toggle", ->
|
82
81
|
|
83
82
|
beforeEach ->
|
84
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
83
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
85
84
|
|
86
85
|
it "shows or hides", ->
|
87
86
|
expect(@dialog.element.css('display')).toEqual('none')
|
@@ -94,7 +93,7 @@ describe "Mercury.Dialog", ->
|
|
94
93
|
describe "#resize", ->
|
95
94
|
|
96
95
|
beforeEach ->
|
97
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
96
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
98
97
|
|
99
98
|
it "calls show", ->
|
100
99
|
spy = spyOn(Mercury.Dialog.prototype, 'show').andCallFake(=>)
|
@@ -105,7 +104,7 @@ describe "Mercury.Dialog", ->
|
|
105
104
|
describe "#show", ->
|
106
105
|
|
107
106
|
beforeEach ->
|
108
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
107
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
109
108
|
|
110
109
|
it "triggers a custom event to hide all other dialogs", ->
|
111
110
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
@@ -157,7 +156,7 @@ describe "Mercury.Dialog", ->
|
|
157
156
|
describe "#appear", ->
|
158
157
|
|
159
158
|
beforeEach ->
|
160
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
159
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
161
160
|
|
162
161
|
it "animates the dialog in", ->
|
163
162
|
@dialog.appear()
|
@@ -170,7 +169,7 @@ describe "Mercury.Dialog", ->
|
|
170
169
|
describe "#hide", ->
|
171
170
|
|
172
171
|
beforeEach ->
|
173
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
172
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
174
173
|
|
175
174
|
it "hides the dialog", ->
|
176
175
|
@dialog.element.css({display: 'block'})
|
@@ -184,7 +183,7 @@ describe "Mercury.Dialog", ->
|
|
184
183
|
beforeEach ->
|
185
184
|
@spyFunction = ->
|
186
185
|
Mercury.dialogHandlers.foo = ->
|
187
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
186
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el, for: $('#button')})
|
188
187
|
|
189
188
|
it "does nothing if there's no url", ->
|
190
189
|
spy = spyOn($, 'ajax').andCallFake(=>)
|
@@ -261,7 +260,7 @@ describe "Mercury.Dialog", ->
|
|
261
260
|
describe "#loadContent", ->
|
262
261
|
|
263
262
|
beforeEach ->
|
264
|
-
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo:
|
263
|
+
@dialog = new Mercury.Dialog('/blank.html', 'foo', {appendTo: fixture.el})
|
265
264
|
|
266
265
|
it "sets loaded to be true", ->
|
267
266
|
@dialog.loadContent()
|
@@ -1,9 +1,8 @@
|
|
1
1
|
describe "Mercury.dialogHandlers.backColor", ->
|
2
2
|
|
3
|
-
template 'mercury/dialogs/backcolor.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
6
|
-
|
4
|
+
fixture.load('mercury/dialogs/backcolor.html')
|
5
|
+
@dialog = {element: $(fixture.el), button: $('#button')}
|
7
6
|
Mercury.dialogHandlers.backColor.call(@dialog)
|
8
7
|
|
9
8
|
describe "when a .picker or .last-picked element is clicked", ->
|
@@ -1,9 +1,8 @@
|
|
1
1
|
describe "Mercury.dialogHandlers.foreColor", ->
|
2
2
|
|
3
|
-
template 'mercury/dialogs/forecolor.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
6
|
-
|
4
|
+
fixture.load('mercury/dialogs/forecolor.html')
|
5
|
+
@dialog = {element: $(fixture.el), button: $('#button')}
|
7
6
|
Mercury.dialogHandlers.foreColor.call(@dialog)
|
8
7
|
|
9
8
|
describe "when a .picker or .last-picked element is clicked", ->
|
@@ -26,7 +25,7 @@ describe "Mercury.dialogHandlers.foreColor", ->
|
|
26
25
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
27
26
|
jasmine.simulate.click($('#white').get(0))
|
28
27
|
expect(spy.callCount).toEqual(1)
|
29
|
-
expect(spy.argsForCall[0]).toEqual(['action', {action: 'foreColor', value: '
|
28
|
+
expect(spy.argsForCall[0]).toEqual(['action', {action: 'foreColor', value: '#FFFFFF'}])
|
30
29
|
|
31
30
|
|
32
31
|
describe "when any other element is clicked", ->
|
@@ -1,9 +1,8 @@
|
|
1
1
|
describe "Mercury.dialogHandlers.formatblock", ->
|
2
2
|
|
3
|
-
template 'mercury/dialogs/formatblock.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
6
|
-
|
4
|
+
fixture.load('mercury/dialogs/formatblock.html')
|
5
|
+
@dialog = {element: $(fixture.el)}
|
7
6
|
Mercury.dialogHandlers.formatblock.call(@dialog)
|
8
7
|
|
9
8
|
describe "when an element with a data-tag attribute is clicked", ->
|
@@ -1,9 +1,8 @@
|
|
1
1
|
describe "Mercury.dialogHandlers.snippetPanel", ->
|
2
2
|
|
3
|
-
template 'mercury/dialogs/snippetpanel.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
6
|
-
|
4
|
+
fixture.load('mercury/dialogs/snippetpanel.html')
|
5
|
+
@dialog = {element: $(fixture.el), button: $('#button')}
|
7
6
|
Mercury.dialogHandlers.snippetPanel.call(@dialog)
|
8
7
|
|
9
8
|
describe "filter", ->
|
@@ -1,9 +1,8 @@
|
|
1
1
|
describe "Mercury.dialogHandlers.style", ->
|
2
2
|
|
3
|
-
template 'mercury/dialogs/style.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
6
|
-
|
4
|
+
fixture.load('mercury/dialogs/style.html')
|
5
|
+
@dialog = {element: $(fixture.el)}
|
7
6
|
Mercury.dialogHandlers.style.call(@dialog)
|
8
7
|
|
9
8
|
describe "when an element with a data-class attribute is clicked", ->
|
@@ -1,8 +1,7 @@
|
|
1
1
|
describe "Mercury.lightview", ->
|
2
2
|
|
3
|
-
template 'mercury/lightview.html'
|
4
|
-
|
5
3
|
beforeEach ->
|
4
|
+
fixture.load('mercury/lightview.html')
|
6
5
|
$.fx.off = true
|
7
6
|
Mercury.displayRect = {fullHeight: 200, width: 1000}
|
8
7
|
Mercury.determinedLocale =
|
@@ -11,8 +10,7 @@ describe "Mercury.lightview", ->
|
|
11
10
|
|
12
11
|
afterEach ->
|
13
12
|
Mercury.config.localization.enabled = false
|
14
|
-
Mercury.lightview.
|
15
|
-
Mercury.lightview.visible = false
|
13
|
+
Mercury.lightview.instance = null
|
16
14
|
$(window).unbind('mercury:refresh')
|
17
15
|
$(window).unbind('mercury:resize')
|
18
16
|
$(document).unbind('keydown')
|
@@ -20,122 +18,135 @@ describe "Mercury.lightview", ->
|
|
20
18
|
describe "singleton method", ->
|
21
19
|
|
22
20
|
beforeEach ->
|
23
|
-
@showSpy = spyOn(Mercury.
|
21
|
+
@showSpy = spyOn(Mercury.Lightview.prototype, 'show').andCallFake(=>)
|
24
22
|
|
25
23
|
it "calls show", ->
|
26
24
|
Mercury.lightview('/foo')
|
27
25
|
expect(@showSpy.callCount).toEqual(1)
|
28
26
|
|
29
|
-
it "returns
|
27
|
+
it "returns an instance", ->
|
30
28
|
ret = Mercury.lightview('/foo')
|
31
|
-
expect(ret).toEqual(Mercury.lightview)
|
29
|
+
expect(ret).toEqual(Mercury.lightview.instance)
|
30
|
+
expect(ret.show).toEqual(Mercury.Lightview.prototype.show)
|
32
31
|
|
33
32
|
|
34
33
|
describe "#show", ->
|
35
34
|
|
36
35
|
beforeEach ->
|
37
|
-
@initializeSpy = spyOn(Mercury.
|
38
|
-
@updateSpy = spyOn(Mercury.
|
39
|
-
@appearSpy = spyOn(Mercury.
|
36
|
+
@initializeSpy = spyOn(Mercury.Lightview.prototype, 'initializeLightview').andCallFake(=>)
|
37
|
+
@updateSpy = spyOn(Mercury.Lightview.prototype, 'update').andCallFake(=>)
|
38
|
+
@appearSpy = spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
39
|
+
|
40
|
+
it "sets options.ujsHandling to true unless set to false", ->
|
41
|
+
instance = new Mercury.Lightview()
|
42
|
+
instance.show()
|
43
|
+
expect(instance.options.ujsHandling).toEqual(true)
|
44
|
+
instance = new Mercury.Lightview('', {ujsHandling: false})
|
45
|
+
instance.show()
|
46
|
+
expect(instance.options.ujsHandling).toEqual(false)
|
40
47
|
|
41
48
|
it "triggers the focus:window event", ->
|
42
49
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
43
|
-
Mercury.
|
50
|
+
new Mercury.Lightview().show()
|
44
51
|
expect(spy.callCount).toEqual(1)
|
45
52
|
expect(spy.argsForCall[0]).toEqual(['focus:window'])
|
46
53
|
|
47
54
|
it "calls initialize", ->
|
48
|
-
Mercury.
|
55
|
+
new Mercury.Lightview().show()
|
49
56
|
expect(@initializeSpy.callCount).toEqual(1)
|
50
57
|
|
51
58
|
describe "if already visible", ->
|
52
59
|
|
53
60
|
it "calls update", ->
|
54
|
-
|
55
|
-
|
61
|
+
lightview = new Mercury.Lightview()
|
62
|
+
lightview.visible = true
|
63
|
+
lightview.show()
|
56
64
|
expect(@updateSpy.callCount).toEqual(1)
|
57
65
|
|
58
66
|
describe "if not visible", ->
|
59
67
|
|
60
68
|
it "calls appear", ->
|
61
|
-
Mercury.
|
69
|
+
lightview = new Mercury.Lightview()
|
70
|
+
lightview.visible = false
|
71
|
+
lightview.show()
|
62
72
|
expect(@appearSpy.callCount).toEqual(1)
|
63
73
|
|
64
74
|
|
65
|
-
describe "#
|
75
|
+
describe "#initializeLightview", ->
|
66
76
|
|
67
77
|
beforeEach ->
|
68
|
-
@buildSpy = spyOn(Mercury.
|
69
|
-
@bindEventsSpy = spyOn(Mercury.
|
78
|
+
@buildSpy = spyOn(Mercury.Lightview.prototype, 'build').andCallFake(=>)
|
79
|
+
@bindEventsSpy = spyOn(Mercury.Lightview.prototype, 'bindEvents').andCallFake(=>)
|
80
|
+
@lightview = new Mercury.Lightview()
|
70
81
|
|
71
82
|
it "calls build", ->
|
72
|
-
|
83
|
+
@lightview.initializeLightview()
|
73
84
|
expect(@buildSpy.callCount).toEqual(1)
|
74
85
|
|
75
86
|
it "calls bindEvents", ->
|
76
|
-
|
87
|
+
@lightview.initializeLightview()
|
77
88
|
expect(@bindEventsSpy.callCount).toEqual(1)
|
78
89
|
|
79
90
|
it "does nothing if already initialized", ->
|
80
|
-
|
81
|
-
|
91
|
+
@lightview.initialized = true
|
92
|
+
@lightview.initializeLightview()
|
82
93
|
expect(@buildSpy.callCount).toEqual(0)
|
83
94
|
|
84
95
|
it "sets initialized to true", ->
|
85
|
-
|
86
|
-
expect(
|
96
|
+
@lightview.initializeLightview()
|
97
|
+
expect(@lightview.initialized).toEqual(true)
|
87
98
|
|
88
99
|
|
89
100
|
describe "#build", ->
|
90
101
|
|
91
102
|
beforeEach ->
|
92
|
-
|
103
|
+
@lightview = new Mercury.Lightview('', {appendTo: fixture.el})
|
93
104
|
|
94
105
|
it "builds an element", ->
|
95
|
-
|
96
|
-
expect($('
|
106
|
+
@lightview.build()
|
107
|
+
expect($('.mercury-lightview', fixture.el).length).toEqual(1)
|
97
108
|
|
98
109
|
it "builds an overlay element", ->
|
99
|
-
|
100
|
-
expect($('
|
110
|
+
@lightview.build()
|
111
|
+
expect($('.mercury-lightview-overlay', fixture.el).length).toEqual(1)
|
101
112
|
|
102
113
|
it "creates a titleElement", ->
|
103
|
-
|
104
|
-
expect($('
|
105
|
-
expect($('
|
106
|
-
expect(
|
114
|
+
@lightview.build()
|
115
|
+
expect($('.mercury-lightview-title', fixture.el).length).toEqual(1)
|
116
|
+
expect($('.mercury-lightview-title', fixture.el).html()).toEqual("<span><\/span>")
|
117
|
+
expect(@lightview.titleElement).toBeDefined()
|
107
118
|
|
108
119
|
it "creates a contentElement", ->
|
109
|
-
|
110
|
-
expect($('
|
111
|
-
expect(
|
120
|
+
@lightview.build()
|
121
|
+
expect($('.mercury-lightview-content', fixture.el).length).toEqual(1)
|
122
|
+
expect(@lightview.contentElement).toBeDefined()
|
112
123
|
|
113
124
|
it "appends to any element", ->
|
114
|
-
|
115
|
-
|
125
|
+
@lightview.options = {appendTo: $('#lightview_container')}
|
126
|
+
@lightview.build()
|
116
127
|
expect($('#lightview_container .mercury-lightview').length).toEqual(1)
|
117
128
|
expect($('#lightview_container .mercury-lightview-overlay').length).toEqual(1)
|
118
129
|
|
119
130
|
it "creates a close button if asked to in the options", ->
|
120
|
-
|
121
|
-
|
122
|
-
expect($('
|
131
|
+
@lightview.options.closeButton = true
|
132
|
+
@lightview.build()
|
133
|
+
expect($('.mercury-lightview-close', fixture.el).length).toEqual(1)
|
123
134
|
|
124
135
|
|
125
136
|
describe "observed events", ->
|
126
137
|
|
127
138
|
beforeEach ->
|
128
|
-
spyOn(Mercury.
|
139
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
129
140
|
|
130
141
|
describe "without a close button", ->
|
131
142
|
|
132
143
|
beforeEach ->
|
133
|
-
Mercury.lightview('/foo', {appendTo:
|
144
|
+
@lightview = Mercury.lightview('/foo', {appendTo: fixture.el})
|
134
145
|
|
135
146
|
describe "custom event: refresh", ->
|
136
147
|
|
137
148
|
it "calls resize telling it stay visible", ->
|
138
|
-
spy = spyOn(
|
149
|
+
spy = spyOn(@lightview, 'resize').andCallFake(=>)
|
139
150
|
Mercury.trigger('refresh')
|
140
151
|
expect(spy.callCount).toEqual(1)
|
141
152
|
expect(spy.argsForCall[0]).toEqual([true])
|
@@ -143,46 +154,46 @@ describe "Mercury.lightview", ->
|
|
143
154
|
describe "custom event: resize", ->
|
144
155
|
|
145
156
|
beforeEach ->
|
146
|
-
|
157
|
+
@lightview.visible = true
|
147
158
|
|
148
159
|
it "calls position", ->
|
149
|
-
spy = spyOn(
|
160
|
+
spy = spyOn(@lightview, 'position').andCallFake(=>)
|
150
161
|
Mercury.trigger('resize')
|
151
162
|
expect(spy.callCount).toEqual(1)
|
152
163
|
|
153
164
|
describe "clicking on the overlay", ->
|
154
165
|
|
155
166
|
it "calls hide", ->
|
156
|
-
spy = spyOn(
|
167
|
+
spy = spyOn(@lightview, 'hide').andCallFake(=>)
|
157
168
|
jasmine.simulate.click($('.mercury-lightview-overlay').get(0))
|
158
169
|
expect(spy.callCount).toEqual(1)
|
159
170
|
|
160
171
|
describe "pressing esc on document", ->
|
161
172
|
|
162
173
|
beforeEach ->
|
163
|
-
|
174
|
+
@lightview.visible = true
|
164
175
|
|
165
176
|
it "calls hide", ->
|
166
|
-
spy = spyOn(
|
177
|
+
spy = spyOn(@lightview, 'hide').andCallFake(=>)
|
167
178
|
jasmine.simulate.keydown(document, {keyCode: 27})
|
168
179
|
expect(spy.callCount).toEqual(1)
|
169
180
|
|
170
181
|
describe "with a close button", ->
|
171
182
|
|
172
183
|
beforeEach ->
|
173
|
-
Mercury.lightview('/foo', {appendTo:
|
184
|
+
@lightview = Mercury.lightview('/foo', {appendTo: fixture.el, closeButton: true})
|
174
185
|
|
175
186
|
describe "clicking on the close button", ->
|
176
187
|
|
177
188
|
it "calls hide", ->
|
178
|
-
spy = spyOn(
|
189
|
+
spy = spyOn(@lightview, 'hide').andCallFake(=>)
|
179
190
|
jasmine.simulate.click($('.mercury-lightview-close').get(0))
|
180
191
|
expect(spy.callCount).toEqual(1)
|
181
192
|
|
182
193
|
describe "clicking on the overlay", ->
|
183
194
|
|
184
195
|
it "doesn't call hide", ->
|
185
|
-
spy = spyOn(
|
196
|
+
spy = spyOn(@lightview, 'hide').andCallFake(=>)
|
186
197
|
jasmine.simulate.click($('.mercury-lightview-overlay').get(0))
|
187
198
|
expect(spy.callCount).toEqual(0)
|
188
199
|
|
@@ -190,8 +201,8 @@ describe "Mercury.lightview", ->
|
|
190
201
|
|
191
202
|
it "sets a success that will load the contents of the response", ->
|
192
203
|
options = {}
|
193
|
-
spy = spyOn(
|
194
|
-
|
204
|
+
spy = spyOn(@lightview, 'loadContent').andCallFake(=>)
|
205
|
+
@lightview.element.trigger('ajax:beforeSend', [null, options])
|
195
206
|
expect(options.success).toBeDefined()
|
196
207
|
options.success('new content')
|
197
208
|
expect(spy.callCount).toEqual(1)
|
@@ -201,74 +212,76 @@ describe "Mercury.lightview", ->
|
|
201
212
|
describe "#appear", ->
|
202
213
|
|
203
214
|
beforeEach ->
|
204
|
-
Mercury.
|
205
|
-
|
206
|
-
|
207
|
-
@
|
208
|
-
|
215
|
+
@lightview = new Mercury.Lightview('/blank.html', {appendTo: fixture.el})
|
216
|
+
@lightview.visible = true
|
217
|
+
spyOn(@lightview, 'update').andCallFake(=>)
|
218
|
+
@loadSpy = spyOn(@lightview, 'load').andCallFake(=>)
|
219
|
+
@positionSpy = spyOn(@lightview, 'position').andCallFake(=>)
|
220
|
+
@lightview.show()
|
209
221
|
|
210
222
|
it "calls position", ->
|
211
|
-
|
223
|
+
@lightview.appear()
|
212
224
|
expect(@positionSpy.callCount).toEqual(1)
|
213
225
|
|
214
226
|
it "shows the overlay", ->
|
215
227
|
expect($('.mercury-lightview-overlay').css('display')).toEqual('none')
|
216
|
-
|
228
|
+
@lightview.appear()
|
217
229
|
expect($('.mercury-lightview-overlay').css('display')).toEqual('block')
|
218
230
|
|
219
231
|
it "animates the overlay to full opacity", ->
|
220
232
|
expect($('.mercury-lightview-overlay').css('opacity')).toEqual('0')
|
221
|
-
|
233
|
+
@lightview.appear()
|
222
234
|
expect($('.mercury-lightview-overlay').css('opacity')).toEqual('1')
|
223
235
|
|
224
236
|
it "calls setTitle", ->
|
225
|
-
spy = spyOn(
|
226
|
-
|
237
|
+
spy = spyOn(@lightview, 'setTitle').andCallFake(=>)
|
238
|
+
@lightview.appear()
|
227
239
|
expect(spy.callCount).toEqual(1)
|
228
240
|
|
229
241
|
it "shows the element", ->
|
230
242
|
expect($('.mercury-lightview').css('display')).toEqual('none')
|
231
|
-
|
243
|
+
@lightview.appear()
|
232
244
|
expect($('.mercury-lightview').css('display')).toEqual('block')
|
233
245
|
|
234
246
|
it "animates the element opacity", ->
|
235
247
|
expect($('.mercury-lightview').css('opacity')).toEqual('0')
|
236
|
-
|
248
|
+
@lightview.appear()
|
237
249
|
expect($('.mercury-lightview').css('opacity')).toEqual('1')
|
238
250
|
|
239
251
|
it "sets visible to true", ->
|
240
|
-
|
241
|
-
|
242
|
-
expect(
|
252
|
+
@lightview.visible = false
|
253
|
+
@lightview.appear()
|
254
|
+
expect(@lightview.visible).toEqual(true)
|
243
255
|
|
244
256
|
it "calls load", ->
|
245
|
-
|
257
|
+
@lightview.appear()
|
246
258
|
expect(@loadSpy.callCount).toEqual(1)
|
247
259
|
|
248
260
|
|
249
261
|
describe "#resize", ->
|
250
262
|
|
251
263
|
beforeEach ->
|
252
|
-
|
253
|
-
|
254
|
-
|
264
|
+
@lightview = new Mercury.Lightview('/blank.html', {appendTo: fixture.el})
|
265
|
+
spyOn(@lightview, 'appear').andCallFake(=>)
|
266
|
+
@lightview.show()
|
267
|
+
@lightview.contentPane = $()
|
255
268
|
|
256
269
|
it "will keep the content element visible if asked to do so", ->
|
257
270
|
$('.mercury-lightview-content').css('visibility', 'visible')
|
258
|
-
|
271
|
+
@lightview.resize(true)
|
259
272
|
expect($('.mercury-lightview-content').css('visibility')).toEqual('visible')
|
260
273
|
|
261
274
|
it "resizes the element and adjusts it's position when empty", ->
|
262
275
|
$('.mercury-lightview').css({display: 'block', visibility: 'visible', top: 0})
|
263
|
-
|
276
|
+
@lightview.resize()
|
264
277
|
expect($('.mercury-lightview').width()).toEqual(300)
|
265
278
|
expect($('.mercury-lightview').offset()).toEqual({top: 35, left: 350})
|
266
279
|
expect($('.mercury-lightview').height()).toEqual(150)
|
267
280
|
|
268
281
|
it "resizes the element and adjusts it's position when it has content", ->
|
269
|
-
|
282
|
+
@lightview.loadContent('<div style="width:600px;height:400px"></div>')
|
270
283
|
$('.mercury-lightview').css({display: 'block', visibility: 'visible', top: 0})
|
271
|
-
|
284
|
+
@lightview.resize()
|
272
285
|
expect($('.mercury-lightview').width()).toEqual(300)
|
273
286
|
expect($('.mercury-lightview').offset()).toEqual({top: 20, left: 350})
|
274
287
|
expect($('.mercury-lightview').height()).toEqual(180)
|
@@ -277,7 +290,7 @@ describe "Mercury.lightview", ->
|
|
277
290
|
describe "#position", ->
|
278
291
|
|
279
292
|
beforeEach ->
|
280
|
-
spyOn(Mercury.
|
293
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
281
294
|
|
282
295
|
# todo: test this
|
283
296
|
it "positions the element", ->
|
@@ -286,10 +299,11 @@ describe "Mercury.lightview", ->
|
|
286
299
|
describe "#update", ->
|
287
300
|
|
288
301
|
beforeEach ->
|
289
|
-
@
|
290
|
-
@
|
291
|
-
@
|
292
|
-
|
302
|
+
@lightview = new Mercury.Lightview()
|
303
|
+
@resetSpy = spyOn(@lightview, 'reset').andCallFake(=>)
|
304
|
+
@resizeSpy = spyOn(@lightview, 'resize').andCallFake(=>)
|
305
|
+
@loadSpy = spyOn(@lightview, 'load').andCallFake(=>)
|
306
|
+
@lightview.update()
|
293
307
|
|
294
308
|
it "calls reset", ->
|
295
309
|
expect(@resetSpy.callCount).toEqual(1)
|
@@ -304,37 +318,37 @@ describe "Mercury.lightview", ->
|
|
304
318
|
describe "#load", ->
|
305
319
|
|
306
320
|
beforeEach ->
|
307
|
-
spyOn(Mercury.
|
321
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
308
322
|
@ajaxSpy = spyOn($, 'ajax')
|
309
|
-
Mercury.lightview('/blank.html', {appendTo:
|
323
|
+
@lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el})
|
310
324
|
|
311
325
|
it "does nothing if there's no url", ->
|
312
|
-
|
326
|
+
@lightview.url = null
|
313
327
|
$('.mercury-lightview').removeClass('loading')
|
314
|
-
|
328
|
+
@lightview.load()
|
315
329
|
expect($('.mercury-lightview').hasClass('loading')).toEqual(false)
|
316
330
|
|
317
331
|
it "sets the loading class on the element", ->
|
318
|
-
|
332
|
+
@lightview.load()
|
319
333
|
expect($('.mercury-lightview').hasClass('loading')).toEqual(true)
|
320
334
|
|
321
335
|
it "calls setTitle", ->
|
322
|
-
spy = spyOn(
|
323
|
-
|
336
|
+
spy = spyOn(@lightview, 'setTitle').andCallFake(=>)
|
337
|
+
@lightview.load()
|
324
338
|
expect(spy.callCount).toEqual(1)
|
325
339
|
|
326
340
|
describe "on a preloaded view", ->
|
327
341
|
|
328
342
|
beforeEach ->
|
329
|
-
@setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((
|
343
|
+
@setTimeoutSpy = spyOn(window, 'setTimeout').andCallFake((callback, timeout) => callback())
|
330
344
|
Mercury.preloadedViews = {'/blank.html': 'this is the preloaded content'}
|
331
345
|
|
332
346
|
afterEach ->
|
333
347
|
Mercury.preloadedViews = {}
|
334
348
|
|
335
349
|
it "calls loadContent with the content in the preloaded view", ->
|
336
|
-
spy = spyOn(
|
337
|
-
|
350
|
+
spy = spyOn(@lightview, 'loadContent').andCallFake(=>)
|
351
|
+
@lightview.load()
|
338
352
|
expect(@setTimeoutSpy.callCount).toEqual(1)
|
339
353
|
expect(spy.callCount).toEqual(1)
|
340
354
|
|
@@ -343,7 +357,7 @@ describe "Mercury.lightview", ->
|
|
343
357
|
it "makes an ajax request", ->
|
344
358
|
@ajaxSpy.andCallFake(=>)
|
345
359
|
spyOn(Mercury, 'ajaxHeaders').andCallFake(=> {'X-CSRFToken': 'f00'})
|
346
|
-
|
360
|
+
@lightview.load()
|
347
361
|
expect(@ajaxSpy.callCount).toEqual(1)
|
348
362
|
expect(@ajaxSpy.argsForCall[0][1]['headers']).toEqual({'X-CSRFToken': 'f00'})
|
349
363
|
|
@@ -353,8 +367,8 @@ describe "Mercury.lightview", ->
|
|
353
367
|
@ajaxSpy.andCallFake((url, options) => options.success('return value'))
|
354
368
|
|
355
369
|
it "calls loadContent and passes the returned data", ->
|
356
|
-
spy = spyOn(
|
357
|
-
|
370
|
+
spy = spyOn(@lightview, 'loadContent').andCallFake(=>)
|
371
|
+
@lightview.load()
|
358
372
|
expect(spy.callCount).toEqual(1)
|
359
373
|
expect(spy.argsForCall[0]).toEqual(['return value'])
|
360
374
|
|
@@ -365,14 +379,14 @@ describe "Mercury.lightview", ->
|
|
365
379
|
|
366
380
|
it "calls hide", ->
|
367
381
|
spyOn(window, 'alert').andCallFake(=>)
|
368
|
-
spy = spyOn(
|
369
|
-
|
382
|
+
spy = spyOn(@lightview, 'hide').andCallFake(=>)
|
383
|
+
@lightview.load()
|
370
384
|
expect(spy.callCount).toEqual(1)
|
371
385
|
|
372
386
|
it "alerts an error message", ->
|
373
|
-
spyOn(
|
387
|
+
spyOn(@lightview, 'hide').andCallFake(=>)
|
374
388
|
spy = spyOn(window, 'alert').andCallFake(=>)
|
375
|
-
|
389
|
+
@lightview.load()
|
376
390
|
expect(spy.callCount).toEqual(1)
|
377
391
|
expect(spy.argsForCall[0]).toEqual(['Mercury was unable to load /blank.html for the lightview.'])
|
378
392
|
|
@@ -380,86 +394,110 @@ describe "Mercury.lightview", ->
|
|
380
394
|
describe "#loadContent", ->
|
381
395
|
|
382
396
|
beforeEach ->
|
383
|
-
spyOn(Mercury.
|
384
|
-
@resizeSpy = spyOn(Mercury.
|
385
|
-
Mercury.lightview('/blank.html', {appendTo:
|
397
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
398
|
+
@resizeSpy = spyOn(Mercury.Lightview.prototype, 'resize').andCallFake(=>)
|
399
|
+
@lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
|
386
400
|
|
387
401
|
it "accepts options and sets them to the instance options", ->
|
388
|
-
|
389
|
-
expect(
|
402
|
+
@lightview.loadContent('content', {title: 'title'})
|
403
|
+
expect(@lightview.options).toEqual({title: 'title'})
|
390
404
|
|
391
|
-
it "calls
|
392
|
-
spy = spyOn(
|
393
|
-
|
405
|
+
it "calls initializeLightview", ->
|
406
|
+
spy = spyOn(@lightview, 'initializeLightview').andCallFake(=>)
|
407
|
+
@lightview.loadContent('content')
|
394
408
|
expect(spy.callCount).toEqual(1)
|
395
409
|
|
396
410
|
it "calls setTitle", ->
|
397
|
-
spy = spyOn(
|
398
|
-
|
411
|
+
spy = spyOn(@lightview, 'setTitle').andCallFake(=>)
|
412
|
+
@lightview.loadContent('content')
|
399
413
|
expect(spy.callCount).toEqual(1)
|
400
414
|
|
401
415
|
it "sets loaded to true", ->
|
402
|
-
|
403
|
-
|
404
|
-
expect(
|
416
|
+
@lightview.loaded = false
|
417
|
+
@lightview.loadContent('content')
|
418
|
+
expect(@lightview.loaded).toEqual(true)
|
405
419
|
|
406
420
|
it "removes the loading class", ->
|
407
421
|
$('.mercury-lightview').addClass('loading')
|
408
|
-
|
422
|
+
@lightview.loadContent('content')
|
409
423
|
expect($('.mercury-lightview').hasClass('loading')).toEqual(false)
|
410
424
|
|
411
425
|
it "sets the content elements html to whatever was passed", ->
|
412
|
-
|
426
|
+
@lightview.loadContent('<span>content</span>')
|
413
427
|
expect($('.mercury-lightview-content').html()).toEqual('<span>content</span>')
|
414
428
|
|
415
429
|
it "hides the contentElement", ->
|
416
430
|
$('.mercury-lightview-content').css('display', 'block')
|
417
|
-
|
431
|
+
@lightview.loadContent('content')
|
418
432
|
expect($('.mercury-lightview-content').css('display')).toEqual('none')
|
419
433
|
expect($('.mercury-lightview-content').css('visibility')).toEqual('hidden')
|
420
434
|
|
421
435
|
it "calls an afterLoad callback (if provided in options)", ->
|
422
436
|
callCount = 0
|
423
|
-
|
437
|
+
@lightview.loadContent('content', {afterLoad: => callCount += 1})
|
424
438
|
expect(callCount).toEqual(1)
|
425
439
|
|
426
|
-
it "calls a handler method if one is set in lightviewHandlers"
|
427
|
-
callCount = 0
|
428
|
-
Mercury.lightviewHandlers['foo'] = => callCount += 1
|
429
|
-
|
430
|
-
expect(callCount).toEqual(1)
|
440
|
+
it "calls a handler method if one is set in lightviewHandlers"#, ->
|
441
|
+
# callCount = 0
|
442
|
+
# Mercury.lightviewHandlers['foo'] = => callCount += 1
|
443
|
+
# @lightview.loadContent('content', {handler: 'foo'})
|
444
|
+
# expect(callCount).toEqual(1)
|
431
445
|
|
432
446
|
it "translates the content if configured", ->
|
433
447
|
Mercury.config.localization.enabled = true
|
434
|
-
|
448
|
+
@lightview.loadContent('<span>foo</span>')
|
435
449
|
expect($('.mercury-lightview-content').html()).toEqual('<span>Bork!</span>')
|
436
450
|
|
451
|
+
it "makes any element with the lightview-close class close the lightview", ->
|
452
|
+
spy = spyOn(@lightview, 'hide').andCallFake(=>)
|
453
|
+
@lightview.loadContent('<span class="lightview-close">foo</span>')
|
454
|
+
jasmine.simulate.click(@lightview.contentElement.find('.lightview-close').get(0))
|
455
|
+
expect(spy.callCount).toEqual(1)
|
456
|
+
|
437
457
|
it "calls resize", ->
|
438
|
-
|
458
|
+
@lightview.loadContent('content')
|
439
459
|
expect(@resizeSpy.callCount).toEqual(1)
|
440
460
|
|
441
461
|
|
442
462
|
describe "#setTitle", ->
|
443
463
|
|
444
464
|
beforeEach ->
|
445
|
-
spyOn(Mercury.
|
446
|
-
Mercury.lightview('/blank.html', {appendTo:
|
465
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
466
|
+
@lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
|
447
467
|
|
448
468
|
it "sets the the title contents to what was provided in the options", ->
|
449
|
-
|
450
|
-
|
469
|
+
@lightview.options = {title: 'new title'}
|
470
|
+
@lightview.setTitle()
|
451
471
|
expect($('.mercury-lightview-title span').html()).toEqual('new title')
|
452
472
|
|
453
473
|
|
474
|
+
describe "#serializeForm", ->
|
475
|
+
|
476
|
+
beforeEach ->
|
477
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
478
|
+
@lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
|
479
|
+
|
480
|
+
describe "without a form", ->
|
481
|
+
|
482
|
+
it "returns an empty object", ->
|
483
|
+
expect(@lightview.serializeForm()).toEqual({})
|
484
|
+
|
485
|
+
describe "with a form", ->
|
486
|
+
|
487
|
+
it "returns an object of the serialized form", ->
|
488
|
+
@lightview.loadContent('<form><input name="options[foo]" value="bar"/></form>')
|
489
|
+
expect(@lightview.serializeForm()).toEqual({options: {foo: 'bar'}})
|
490
|
+
|
491
|
+
|
454
492
|
describe "#reset", ->
|
455
493
|
|
456
494
|
beforeEach ->
|
457
|
-
spyOn(Mercury.
|
458
|
-
Mercury.lightview('/blank.html', {appendTo:
|
495
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
496
|
+
@lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el, title: 'title'})
|
459
497
|
|
460
498
|
it "clears the title and content elements", ->
|
461
499
|
$('.mercury-lightview-content').html('content')
|
462
|
-
|
500
|
+
@lightview.reset()
|
463
501
|
expect($('.mercury-lightview-content').html()).toEqual('')
|
464
502
|
expect($('.mercury-lightview-title span').html()).toEqual('')
|
465
503
|
|
@@ -467,31 +505,31 @@ describe "Mercury.lightview", ->
|
|
467
505
|
describe "#hide", ->
|
468
506
|
|
469
507
|
beforeEach ->
|
470
|
-
spyOn(Mercury.
|
471
|
-
Mercury.lightview('/blank.html', {appendTo:
|
508
|
+
spyOn(Mercury.Lightview.prototype, 'appear').andCallFake(=>)
|
509
|
+
@lightview = Mercury.lightview('/blank.html', {appendTo: fixture.el})
|
472
510
|
|
473
511
|
it "triggers the focus:frame event", ->
|
474
512
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
475
|
-
|
513
|
+
@lightview.hide()
|
476
514
|
expect(spy.callCount).toEqual(1)
|
477
515
|
expect(spy.argsForCall[0]).toEqual(['focus:frame'])
|
478
516
|
|
479
517
|
it "hides the element", ->
|
480
|
-
|
481
|
-
|
518
|
+
@lightview.element.css('display:block')
|
519
|
+
@lightview.hide()
|
482
520
|
expect($('.mercury-lightview').css('display')).toEqual('none')
|
483
521
|
|
484
522
|
it "hides the overlay element", ->
|
485
|
-
|
486
|
-
|
523
|
+
@lightview.overlay.css('display:block')
|
524
|
+
@lightview.hide()
|
487
525
|
expect($('.mercury-lightview-overlay').css('display')).toEqual('none')
|
488
526
|
|
489
527
|
it "calls reset", ->
|
490
|
-
spy = spyOn(
|
491
|
-
|
528
|
+
spy = spyOn(@lightview, 'reset').andCallFake(=>)
|
529
|
+
@lightview.hide()
|
492
530
|
expect(spy.callCount).toEqual(1)
|
493
531
|
|
494
532
|
it "sets visible to false", ->
|
495
|
-
|
496
|
-
|
497
|
-
expect(
|
533
|
+
@lightview.visible = true
|
534
|
+
@lightview.hide()
|
535
|
+
expect(@lightview.visible).toEqual(false)
|