kiteditor 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/{lib/generators/mercury/install/images/templates → app/controllers/mercury}/images_controller.rb +0 -0
- data/{lib/generators/mercury/install/images/templates/ar_paperclip_image.rb → app/models/mercury/image.rb} +0 -7
- data/app/views/layouts/mercury.html.erb +20 -10
- data/app/views/mercury/modals/character.html +1 -1
- data/app/views/mercury/modals/htmleditor.html +7 -3
- data/app/views/mercury/modals/link.html +51 -37
- data/app/views/mercury/modals/media.html +0 -102
- data/app/views/mercury/modals/table.html +73 -79
- data/app/views/mercury/panels/snippets.html +1 -6
- data/app/views/mercury/snippets/example/options.html.erb +27 -23
- data/{lib/generators/mercury/install/images/templates/ar_paperclip_image_migration.rb → db/migrate/20110526035601_create_mercury_images.rb} +0 -0
- data/features/loading/loading.feature +2 -5
- data/features/loading/user_interface.feature +7 -9
- data/features/regions/{full → editable}/advanced_editing.feature +0 -0
- data/features/regions/editable/basic_editing.feature +195 -0
- data/features/regions/{full → editable}/inserting_links.feature +19 -20
- data/features/regions/{full → editable}/inserting_media.feature +18 -36
- data/features/regions/{full → editable}/inserting_snippets.feature +18 -28
- data/features/regions/{full → editable}/inserting_special_characters.feature +2 -2
- data/features/regions/editable/inserting_tables.feature +109 -0
- data/features/regions/{full → editable}/pasting.feature +0 -0
- data/features/regions/{full → editable}/uploading_images.feature +0 -0
- data/features/regions/{markdown → markupable}/advanced_editing.feature +0 -0
- data/features/regions/{markdown → markupable}/basic_editing.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_links.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_media.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_snippets.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_special_characters.feature +0 -0
- data/features/regions/{markdown → markupable}/inserting_tables.feature +0 -0
- data/features/regions/{image → markupable}/uploading_images.feature +0 -0
- data/features/regions/{snippets → snippetable}/advanced_editing.feature +0 -0
- data/features/regions/{snippets → snippetable}/basic_editing.feature +0 -0
- data/features/regions/{snippets → snippetable}/inserting_snippets.feature +0 -0
- data/features/saving/saving.feature +8 -8
- data/features/step_definitions/mercury_steps.rb +438 -1
- data/features/support/env.rb +1 -11
- data/{lib/mercury/cucumber → features}/support/mercury_contents.rb +3 -3
- data/{lib/mercury/cucumber → features}/support/mercury_selectors.rb +20 -0
- data/features/support/selectors.rb +0 -23
- data/lib/generators/mercury/install/install_generator.rb +23 -12
- data/lib/generators/mercury/install/{images/templates → templates}/mongoid_paperclip_image.rb +0 -0
- data/lib/mercury/authentication.rb +0 -1
- data/lib/mercury-rails.rb +2 -1
- data/spec/javascripts/mercury/{dialog_spec.coffee → dialog_spec.js.coffee} +12 -11
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +4 -3
- data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/lightview_spec.js.coffee +142 -180
- data/spec/javascripts/mercury/mercury_spec.js.coffee +13 -19
- data/spec/javascripts/mercury/modal_spec.js.coffee +148 -192
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +5 -4
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +34 -107
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +26 -106
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +3 -2
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +40 -50
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +80 -124
- data/spec/javascripts/mercury/palette_spec.js.coffee +5 -4
- data/spec/javascripts/mercury/panel_spec.js.coffee +12 -9
- data/spec/javascripts/mercury/region_spec.js.coffee +17 -22
- data/spec/javascripts/mercury/regions/{full_spec.js.coffee → editable_spec.js.coffee} +28 -26
- data/spec/javascripts/mercury/regions/{markdown_spec.js.coffee → markupable_spec.js.coffee} +34 -32
- data/spec/javascripts/mercury/regions/{snippets_spec.js.coffee → snippetable_spec.js.coffee} +55 -54
- data/spec/javascripts/mercury/select_spec.js.coffee +5 -4
- data/spec/javascripts/mercury/snippet_spec.js.coffee +16 -92
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +16 -31
- data/spec/javascripts/mercury/statusbar_spec.js.coffee +10 -9
- data/spec/javascripts/mercury/table_editor_spec.js.coffee +2 -1
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +9 -7
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +26 -55
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +13 -13
- data/spec/javascripts/mercury/toolbar_spec.js.coffee +14 -43
- data/spec/javascripts/mercury/tooltip_spec.js.coffee +2 -1
- data/spec/javascripts/mercury/uploader_spec.js.coffee +33 -47
- data/spec/javascripts/{support/event_simulation.js → spec_helper.js} +2 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialog.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/backcolor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/forecolor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/formatblock.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/snippetpanel.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/dialogs/style.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/lightview.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modal.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modals/htmleditor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modals/insertcharacter.html +0 -0
- data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
- data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
- data/spec/javascripts/{fixtures → templates}/mercury/modals/insertsnippet.html +0 -0
- data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
- data/spec/javascripts/{fixtures → templates}/mercury/page_editor.html +4 -4
- data/spec/javascripts/{fixtures → templates}/mercury/palette.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/panel.html +0 -0
- data/spec/javascripts/templates/mercury/region.html +2 -0
- data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
- data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
- data/spec/javascripts/{fixtures → templates}/mercury/select.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/snippet.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/snippet_toolbar.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/statusbar.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/table_editor.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.button.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.button_group.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.expander.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/toolbar.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/tooltip.html +0 -0
- data/spec/javascripts/{fixtures → templates}/mercury/uploader.html +0 -0
- data/{app → vendor}/assets/images/mercury/button.png +0 -0
- data/{app → vendor}/assets/images/mercury/close.png +0 -0
- data/{app → vendor}/assets/images/mercury/loading-dark.gif +0 -0
- data/{app → vendor}/assets/images/mercury/loading-light.gif +0 -0
- data/{app → vendor}/assets/images/mercury/missing-image.png +0 -0
- data/{app → vendor}/assets/images/mercury/search-icon.png +0 -0
- data/{app → vendor}/assets/images/mercury/temp-logo.png +0 -0
- data/{app/assets/javascripts → vendor/assets/javascripts/mercury/dependencies}/jquery-1.7.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery.additions.js +13 -103
- data/{app → vendor}/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/liquidmetal.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dependencies/showdown.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialog.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialogs/backcolor.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/dialogs/formatblock.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/dialogs/style.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/finalize.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/history_buffer.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/lightview.js.coffee +17 -38
- data/{features/regions/markdown/uploading_images.feature → vendor/assets/javascripts/mercury/locales/da.locale.js.coffee} +0 -0
- data/{app → vendor}/assets/javascripts/mercury/locales/de.locale.js.coffee +10 -4
- data/{app → vendor}/assets/javascripts/mercury/locales/es.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/example.local.js.coffee +5 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/fr.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/it.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/ko.local.js.coffee +10 -4
- data/{app → vendor}/assets/javascripts/mercury/locales/nl.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/pt.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/sv.local.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +9 -3
- data/{app → vendor}/assets/javascripts/mercury/mercury.js.coffee +1 -10
- data/{app → vendor}/assets/javascripts/mercury/modal.js.coffee +40 -62
- data/{app → vendor}/assets/javascripts/mercury/modals/htmleditor.js.coffee +2 -3
- data/{app → vendor}/assets/javascripts/mercury/modals/insertcharacter.js.coffee +0 -1
- data/{app → vendor}/assets/javascripts/mercury/modals/insertsnippet.js.coffee +0 -2
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +54 -0
- data/{app → vendor}/assets/javascripts/mercury/native_extensions.js.coffee +6 -0
- data/{app → vendor}/assets/javascripts/mercury/page_editor.js.coffee +50 -84
- data/{app → vendor}/assets/javascripts/mercury/palette.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/panel.js.coffee +2 -3
- data/{app → vendor}/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
- data/{app → vendor}/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/region.js.coffee +17 -18
- data/{app/assets/javascripts/mercury/regions/full.js.coffee → vendor/assets/javascripts/mercury/regions/editable.js.coffee} +31 -41
- data/{app/assets/javascripts/mercury/regions/markdown.js.coffee → vendor/assets/javascripts/mercury/regions/markupable.js.coffee} +24 -29
- data/{app → vendor}/assets/javascripts/mercury/regions/simple.js.coffee +54 -11
- data/{app/assets/javascripts/mercury/regions/snippets.js.coffee → vendor/assets/javascripts/mercury/regions/snippetable.js.coffee} +9 -10
- data/{app → vendor}/assets/javascripts/mercury/select.js.coffee +1 -1
- data/{app → vendor}/assets/javascripts/mercury/snippet_toolbar.js.coffee +6 -19
- data/{app → vendor}/assets/javascripts/mercury/statusbar.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/support/history.js +0 -0
- data/{app → vendor}/assets/javascripts/mercury/table_editor.js.coffee +0 -16
- data/{app → vendor}/assets/javascripts/mercury/toolbar.button.js.coffee +30 -45
- data/{app → vendor}/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
- data/{app → vendor}/assets/javascripts/mercury/toolbar.expander.js.coffee +4 -4
- data/{app → vendor}/assets/javascripts/mercury/toolbar.js.coffee +6 -10
- data/{app → vendor}/assets/javascripts/mercury/tooltip.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/mercury/uploader.js.coffee +19 -37
- data/{app → vendor}/assets/javascripts/mercury.js +87 -60
- data/vendor/assets/javascripts/mercury_loader.js +193 -0
- data/vendor/assets/javascripts/mercury_overrides.js +6 -0
- data/{app → vendor}/assets/stylesheets/mercury/all_images.css.erb +2 -6
- data/{app → vendor}/assets/stylesheets/mercury/dialog.css +8 -21
- data/{app → vendor}/assets/stylesheets/mercury/lightview.css +56 -6
- data/vendor/assets/stylesheets/mercury/mercury.css +151 -0
- data/{app → vendor}/assets/stylesheets/mercury/modal.css +32 -15
- data/{app → vendor}/assets/stylesheets/mercury/statusbar.css +0 -0
- data/{app → vendor}/assets/stylesheets/mercury/toolbar.css +1 -4
- data/{app → vendor}/assets/stylesheets/mercury/tooltip.css +0 -0
- data/{app → vendor}/assets/stylesheets/mercury/uploader.css +4 -4
- data/{app → vendor}/assets/stylesheets/mercury.css +5 -1
- data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
- metadata +197 -367
- data/POST_INSTALL +0 -21
- data/app/assets/images/mercury/default-snippet.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/app/assets/javascripts/mercury/locales/ar.locale.js.coffee +0 -201
- data/app/assets/javascripts/mercury/locales/da.locale.js.coffee +0 -208
- data/app/assets/javascripts/mercury/locales/hu.locale.js.coffee +0 -209
- data/app/assets/javascripts/mercury/locales/pl.locale.js.coffee +0 -213
- data/app/assets/javascripts/mercury/locales/ru.locale.js.coffee +0 -200
- data/app/assets/javascripts/mercury/locales/uk.locale.js.coffee +0 -200
- data/app/assets/javascripts/mercury/locales/zh.local.js.coffee +0 -203
- data/app/assets/javascripts/mercury/mercury-compiled.js +0 -10720
- data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +0 -152
- data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +0 -132
- data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +0 -68
- data/app/assets/javascripts/mercury/regions/image.js.coffee +0 -93
- data/app/assets/javascripts/mercury/snippet.js.coffee +0 -136
- data/app/assets/stylesheets/_mercury-bootstrap-overrides.scss +0 -61
- data/app/assets/stylesheets/_mercury-sass.scss +0 -33
- data/app/assets/stylesheets/mercury/bootstrap-ish.css +0 -1367
- data/app/assets/stylesheets/mercury/bootstrap-overrides.css +0 -61
- data/app/assets/stylesheets/mercury/mercury.css +0 -43
- data/app/helpers/mercury_helper.rb +0 -7
- data/app/views/layouts/mercury.html.haml +0 -19
- data/app/views/layouts/mercury.html.slim +0 -19
- data/app/views/mercury/snippets/no_options/preview.html.erb +0 -1
- data/config/routes.rb +0 -9
- data/features/generators/authentication.feature +0 -10
- data/features/generators/images.feature +0 -41
- data/features/generators/install.feature +0 -21
- data/features/regions/full/basic_editing.feature +0 -198
- data/features/regions/full/inserting_tables.feature +0 -109
- data/features/regions/simple/basic_editing.feature +0 -5
- data/features/step_definitions/custom_web_steps.rb +0 -22
- data/features/step_definitions/generator_steps.rb +0 -23
- data/features/support/aruba.rb +0 -28
- data/lib/generators/mercury/install/authentication/authentication_generator.rb +0 -17
- data/lib/generators/mercury/install/images/images_generator.rb +0 -47
- data/lib/mercury/cucumber/step_definitions/mercury_steps.rb +0 -408
- data/lib/mercury/cucumber/step_definitions.rb +0 -13
- data/lib/mercury/engine.rb +0 -19
- data/lib/mercury/rails.rb +0 -5
- data/lib/mercury/version.rb +0 -3
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/prototype.js +0 -6082
- data/spec/dummy/app/assets/stylesheets/application.css.scss +0 -110
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/app/views/layouts/mercury.html.erb +0 -28
- data/spec/dummy/config/application.rb +0 -58
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -10
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/teabag.rb +0 -9
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -5
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/blank.html +0 -1
- 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 +0 -279
- data/spec/dummy/script/rails +0 -6
- data/spec/javascripts/fixtures/mercury/modals/insertlink.html +0 -67
- data/spec/javascripts/fixtures/mercury/modals/insertmedia.html +0 -87
- data/spec/javascripts/fixtures/mercury/modals/inserttable.html +0 -73
- data/spec/javascripts/fixtures/mercury/region.html +0 -6
- data/spec/javascripts/fixtures/mercury/regions/full.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/image.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/markdown.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/simple.html +0 -1
- data/spec/javascripts/fixtures/mercury/regions/snippets.html +0 -4
- data/spec/javascripts/mercury/regions/image_spec.js.coffee +0 -33
- data/spec/javascripts/mercury/regions/simple_spec.js.coffee +0 -32
- data/spec/javascripts/spec_helper.coffee +0 -4
- data/spec/teabag_env.rb +0 -32
@@ -1,8 +1,9 @@
|
|
1
1
|
describe "Mercury.Region", ->
|
2
2
|
|
3
|
+
template 'mercury/region.html'
|
4
|
+
|
3
5
|
beforeEach ->
|
4
|
-
|
5
|
-
Mercury.config.regions.attribute = 'custom-region-attribute'
|
6
|
+
Mercury.config.regions.className = 'custom-region-class'
|
6
7
|
Mercury.config.regions.dataAttributes = []
|
7
8
|
|
8
9
|
afterEach ->
|
@@ -126,17 +127,17 @@ describe "Mercury.Region", ->
|
|
126
127
|
|
127
128
|
it "does nothing if in preview mode", ->
|
128
129
|
@region.previewing = true
|
129
|
-
jasmine.simulate.mousemove($('#region_with_snippet .
|
130
|
+
jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
|
130
131
|
expect(@triggerSpy.callCount).toEqual(0)
|
131
132
|
|
132
133
|
it "does nothing if it's not the active region", ->
|
133
134
|
Mercury.region = {}
|
134
|
-
jasmine.simulate.mousemove($('#region_with_snippet .
|
135
|
+
jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
|
135
136
|
expect(@triggerSpy.callCount).toEqual(0)
|
136
137
|
|
137
138
|
it "shows the snippet toolbar if a snippet was moused over", ->
|
138
139
|
Mercury.region = @region
|
139
|
-
jasmine.simulate.mousemove($('#region_with_snippet .
|
140
|
+
jasmine.simulate.mousemove($('#region_with_snippet .mercury-snippet').get(0))
|
140
141
|
expect(@triggerSpy.callCount).toEqual(1)
|
141
142
|
expect(@triggerSpy.argsForCall[0][0]).toEqual('show:toolbar')
|
142
143
|
|
@@ -156,7 +157,7 @@ describe "Mercury.Region", ->
|
|
156
157
|
expect(@triggerSpy.argsForCall[0]).toEqual(['hide:toolbar', {type: 'snippet', immediately: false}])
|
157
158
|
|
158
159
|
|
159
|
-
describe "#
|
160
|
+
describe "#html", ->
|
160
161
|
|
161
162
|
beforeEach ->
|
162
163
|
@region = new Mercury.Region($('#region_with_snippet'), window)
|
@@ -165,15 +166,11 @@ describe "Mercury.Region", ->
|
|
165
166
|
|
166
167
|
it "returns the html of the element", ->
|
167
168
|
content = @region.content()
|
168
|
-
expect(content).toEqual('contents<div class="
|
169
|
+
expect(content).toEqual('contents<div class="mercury-snippet" data-snippet="snippet_1" data-version="1">snippet</div>')
|
169
170
|
|
170
171
|
it "replaces snippet content with an indentifier if asked", ->
|
171
172
|
content = @region.content(null, true)
|
172
|
-
expect(content).toEqual('contents<div class="
|
173
|
-
|
174
|
-
it "does not execute JavaScript contained within the region (bug fix)", ->
|
175
|
-
(new Mercury.Region($('#region_with_javascript_snippet'), window)).content()
|
176
|
-
expect($('#modifiable-element').children().length).toEqual(0)
|
173
|
+
expect(content).toEqual('contents<div class="mercury-snippet" data-snippet="snippet_1">[snippet_1]</div>')
|
177
174
|
|
178
175
|
describe "setting html", ->
|
179
176
|
|
@@ -198,8 +195,9 @@ describe "Mercury.Region", ->
|
|
198
195
|
it "sets previewing to true", ->
|
199
196
|
expect(@region.previewing).toEqual(true)
|
200
197
|
|
201
|
-
it "
|
202
|
-
expect(@region.element.
|
198
|
+
it "swaps classes on the element", ->
|
199
|
+
expect(@region.element.hasClass('custom-region-class')).toEqual(false)
|
200
|
+
expect(@region.element.hasClass('custom-region-class-preview')).toEqual(true)
|
203
201
|
|
204
202
|
it "triggers a blur event", ->
|
205
203
|
expect(@triggerSpy.callCount).toEqual(1)
|
@@ -214,8 +212,9 @@ describe "Mercury.Region", ->
|
|
214
212
|
it "sets previewing to false", ->
|
215
213
|
expect(@region.previewing).toEqual(false)
|
216
214
|
|
217
|
-
it "
|
218
|
-
expect(@region.element.
|
215
|
+
it "swaps classes on the element", ->
|
216
|
+
expect(@region.element.hasClass('custom-region-class-preview')).toEqual(false)
|
217
|
+
expect(@region.element.hasClass('custom-region-class')).toEqual(true)
|
219
218
|
|
220
219
|
it "calls focus if it's the active region", ->
|
221
220
|
expect(@focusSpy.callCount).toEqual(1)
|
@@ -271,10 +270,6 @@ describe "Mercury.Region", ->
|
|
271
270
|
@region.element.attr('data-version', 2)
|
272
271
|
expect(@region.dataAttributes()).toEqual({scope: 'scope', version: '2'})
|
273
272
|
|
274
|
-
it "looks to @container if it's set", ->
|
275
|
-
@region.container = $('<div>').attr('data-version', 3)
|
276
|
-
expect(@region.dataAttributes()).toEqual({scope: undefined, version: '3'})
|
277
|
-
|
278
273
|
|
279
274
|
describe "#serialize", ->
|
280
275
|
|
@@ -285,7 +280,7 @@ describe "Mercury.Region", ->
|
|
285
280
|
|
286
281
|
it "returns an object with it's type, value, and snippets", ->
|
287
282
|
serialized = @region.serialize()
|
288
|
-
expect(serialized.type).toEqual('
|
283
|
+
expect(serialized.type).toEqual('region')
|
289
284
|
expect(serialized.value).toEqual('contents')
|
290
285
|
expect(serialized.snippets).toEqual({})
|
291
286
|
expect(serialized.data).toEqual({})
|
@@ -297,7 +292,7 @@ describe "Mercury.Region", ->
|
|
297
292
|
|
298
293
|
it "returns an object with it's type, value, data and snippets", ->
|
299
294
|
serialized = @region.serialize()
|
300
|
-
expect(serialized.type).toEqual('
|
295
|
+
expect(serialized.type).toEqual('region')
|
301
296
|
expect(serialized.value).toEqual('contents')
|
302
297
|
expect(serialized.snippets).toEqual({})
|
303
298
|
expect(serialized.data).toEqual({scope: 'scope', version: '1'})
|
@@ -1,35 +1,36 @@
|
|
1
|
-
describe "Mercury.Regions.
|
1
|
+
describe "Mercury.Regions.Editable", ->
|
2
|
+
|
3
|
+
template 'mercury/regions/editable.html'
|
2
4
|
|
3
5
|
beforeEach ->
|
4
|
-
|
5
|
-
@regionElement = $('#full_region1')
|
6
|
+
@regionElement = $('#editable_region1')
|
6
7
|
|
7
8
|
describe "constructor", ->
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
beforeEach ->
|
11
|
+
@buildSpy = spyOn(Mercury.Regions.Editable.prototype, 'build').andCallFake(=>)
|
12
|
+
@bindEventsSpy = spyOn(Mercury.Regions.Editable.prototype, 'bindEvents').andCallFake(=>)
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
it "expects an element and window", ->
|
15
|
+
@region = new Mercury.Regions.Editable(@regionElement, window)
|
16
|
+
expect(@region.element.get(0)).toEqual($('#editable_region1').get(0))
|
17
|
+
expect(@region.window).toEqual(window)
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
it "accepts options", ->
|
20
|
+
@region = new Mercury.Regions.Editable(@regionElement, window, {foo: 'something'})
|
21
|
+
expect(@region.options).toEqual({foo: 'something'})
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
it "sets it's type", ->
|
24
|
+
@region = new Mercury.Regions.Editable(@regionElement, window)
|
25
|
+
expect(@region.type).toEqual('editable')
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
it "calls build", ->
|
28
|
+
@region = new Mercury.Regions.Editable(@regionElement, window)
|
29
|
+
expect(@buildSpy.callCount).toEqual(1)
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
it "calls bindEvents", ->
|
32
|
+
@region = new Mercury.Regions.Editable(@regionElement, window)
|
33
|
+
expect(@bindEventsSpy.callCount).toEqual(1)
|
33
34
|
|
34
35
|
|
35
36
|
describe "#build", ->
|
@@ -325,12 +326,13 @@ describe "Mercury.Regions.Full", ->
|
|
325
326
|
|
326
327
|
|
327
328
|
|
328
|
-
describe "Mercury.Regions.
|
329
|
+
describe "Mercury.Regions.Editable.actions", ->
|
330
|
+
|
331
|
+
template 'mercury/regions/editable.html'
|
329
332
|
|
330
333
|
beforeEach ->
|
331
|
-
|
332
|
-
#@
|
333
|
-
#@actions = Mercury.Regions.Full.actions
|
334
|
+
#@region = new Mercury.Regions.Editable($('#editable_region1'), window)
|
335
|
+
#@actions = Mercury.Regions.Editable.actions
|
334
336
|
|
335
337
|
#
|
336
338
|
# behaviors
|
@@ -1,42 +1,43 @@
|
|
1
|
-
describe "Mercury.Regions.
|
1
|
+
describe "Mercury.Regions.Markupable", ->
|
2
|
+
|
3
|
+
template 'mercury/regions/markupable.html'
|
2
4
|
|
3
5
|
beforeEach ->
|
4
|
-
|
5
|
-
@regionElement = $('#markdown_region1')
|
6
|
+
@regionElement = $('#markupable_region1')
|
6
7
|
|
7
8
|
describe "constructor", ->
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
beforeEach ->
|
11
|
+
@buildSpy = spyOn(Mercury.Regions.Markupable.prototype, 'build').andCallFake(=>)
|
12
|
+
@bindEventsSpy = spyOn(Mercury.Regions.Markupable.prototype, 'bindEvents').andCallFake(=>)
|
13
|
+
spyOn(Mercury.Regions.Markupable.prototype, 'pushHistory').andCallFake(=>)
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
it "expects an element and window", ->
|
16
|
+
@region = new Mercury.Regions.Markupable(@regionElement, window)
|
17
|
+
expect(@region.element.get(0)).toEqual($('#markupable_region1').get(0))
|
18
|
+
expect(@region.window).toEqual(window)
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
it "accepts options", ->
|
21
|
+
@region = new Mercury.Regions.Markupable(@regionElement, window, {foo: 'something'})
|
22
|
+
expect(@region.options).toEqual({foo: 'something'})
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
it "sets it's type", ->
|
25
|
+
@region = new Mercury.Regions.Markupable(@regionElement, window)
|
26
|
+
expect(@region.type).toEqual('markupable')
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
it "creates a markdown converter using Showdown", ->
|
29
|
+
spy = spyOn(Showdown, 'converter').andCallFake(=>)
|
30
|
+
@region = new Mercury.Regions.Markupable(@regionElement, window)
|
31
|
+
expect(spy.callCount).toEqual(1)
|
32
|
+
expect(@region.converter).toBeDefined()
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
it "calls build", ->
|
35
|
+
@region = new Mercury.Regions.Markupable(@regionElement, window)
|
36
|
+
expect(@buildSpy.callCount).toEqual(1)
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
it "calls bindEvents", ->
|
39
|
+
@region = new Mercury.Regions.Markupable(@regionElement, window)
|
40
|
+
expect(@bindEventsSpy.callCount).toEqual(1)
|
40
41
|
|
41
42
|
|
42
43
|
describe "#build", ->
|
@@ -265,12 +266,13 @@ describe "Mercury.Regions.Markdown", ->
|
|
265
266
|
|
266
267
|
|
267
268
|
|
268
|
-
describe "Mercury.Regions.
|
269
|
+
describe "Mercury.Regions.Markupable.actions", ->
|
270
|
+
|
271
|
+
template 'mercury/regions/markupable.html'
|
269
272
|
|
270
273
|
beforeEach ->
|
271
|
-
|
272
|
-
#@
|
273
|
-
#@actions = Mercury.Regions.Markdown.actions
|
274
|
+
#@region = new Mercury.Regions.Markupable($('#markupable_region1'), window)
|
275
|
+
#@actions = Mercury.Regions.Markupable.actions
|
274
276
|
|
275
277
|
describe ".undo", ->
|
276
278
|
|
data/spec/javascripts/mercury/regions/{snippets_spec.js.coffee → snippetable_spec.js.coffee}
RENAMED
@@ -1,8 +1,9 @@
|
|
1
|
-
describe "Mercury.Regions.
|
1
|
+
describe "Mercury.Regions.Snippetable", ->
|
2
|
+
|
3
|
+
template 'mercury/regions/snippetable.html'
|
2
4
|
|
3
5
|
beforeEach ->
|
4
|
-
|
5
|
-
@regionElement = $('#snippets_region1')
|
6
|
+
@regionElement = $('#snippetable_region1')
|
6
7
|
|
7
8
|
afterEach ->
|
8
9
|
@region = null
|
@@ -11,50 +12,50 @@ describe "Mercury.Regions.Snippets", ->
|
|
11
12
|
describe "constructor", ->
|
12
13
|
|
13
14
|
beforeEach ->
|
14
|
-
@buildSpy = spyOn(Mercury.Regions.
|
15
|
-
@bindEventsSpy = spyOn(Mercury.Regions.
|
16
|
-
@makeSortableSpy = spyOn(Mercury.Regions.
|
15
|
+
@buildSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'build').andCallFake(=>)
|
16
|
+
@bindEventsSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'bindEvents').andCallFake(=>)
|
17
|
+
@makeSortableSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable').andCallFake(=>)
|
17
18
|
|
18
19
|
it "expects an element and window", ->
|
19
|
-
@region = new Mercury.Regions.
|
20
|
-
expect(@region.element.get(0)).toEqual($('#
|
20
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
21
|
+
expect(@region.element.get(0)).toEqual($('#snippetable_region1').get(0))
|
21
22
|
expect(@region.window).toEqual(window)
|
22
23
|
|
23
24
|
it "accepts options", ->
|
24
|
-
@region = new Mercury.Regions.
|
25
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window, {foo: 'something'})
|
25
26
|
expect(@region.options).toEqual({foo: 'something'})
|
26
27
|
|
27
28
|
it "sets it's type", ->
|
28
|
-
@region = new Mercury.Regions.
|
29
|
-
expect(@region.type
|
29
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
30
|
+
expect(@region.type).toEqual('snippetable')
|
30
31
|
|
31
32
|
it "calls build", ->
|
32
|
-
@region = new Mercury.Regions.
|
33
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
33
34
|
expect(@buildSpy.callCount).toEqual(1)
|
34
35
|
|
35
36
|
it "calls bindEvents", ->
|
36
|
-
@region = new Mercury.Regions.
|
37
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
37
38
|
expect(@bindEventsSpy.callCount).toEqual(1)
|
38
39
|
|
39
40
|
it "makes the snippets sortable", ->
|
40
|
-
@region = new Mercury.Regions.
|
41
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
41
42
|
expect(@makeSortableSpy.callCount).toEqual(1)
|
42
43
|
|
43
44
|
|
44
45
|
describe "#build", ->
|
45
46
|
|
46
47
|
beforeEach ->
|
47
|
-
spyOn(Mercury.Regions.
|
48
|
+
spyOn(Mercury.Regions.Snippetable.prototype, 'bindEvents').andCallFake(=>)
|
48
49
|
|
49
50
|
it "sets the element min-height to 20 if it's min-height is 0 (or not set)", ->
|
50
|
-
@region = new Mercury.Regions.
|
51
|
-
expect($('#
|
51
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
52
|
+
expect($('#snippetable_region1').css('minHeight')).toEqual('20px')
|
52
53
|
|
53
54
|
|
54
55
|
describe "observed events", ->
|
55
56
|
|
56
57
|
beforeEach ->
|
57
|
-
@region = new Mercury.Regions.
|
58
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
58
59
|
Mercury.region = @region
|
59
60
|
|
60
61
|
describe "custom event: unfocus:regions", ->
|
@@ -120,33 +121,33 @@ describe "Mercury.Regions.Snippets", ->
|
|
120
121
|
describe "keydown on document (for undo / redo)", ->
|
121
122
|
|
122
123
|
it "calls execCommand with undo on meta+z", ->
|
123
|
-
spy = spyOn(Mercury.Regions.
|
124
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
|
124
125
|
jasmine.simulate.keydown(document, {shiftKey: false, metaKey: true, keyCode: 90})
|
125
126
|
expect(spy.callCount).toEqual(1)
|
126
127
|
expect(spy.argsForCall[0]).toEqual(['undo'])
|
127
128
|
|
128
129
|
it "calls execCommand with redo on shift+meta+z", ->
|
129
|
-
spy = spyOn(Mercury.Regions.
|
130
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
|
130
131
|
jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
|
131
132
|
expect(spy.callCount).toEqual(1)
|
132
133
|
expect(spy.argsForCall[0]).toEqual(['redo'])
|
133
134
|
|
134
135
|
it "does nothing if previewing", ->
|
135
136
|
@region.previewing = true
|
136
|
-
spy = spyOn(Mercury.Regions.
|
137
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
|
137
138
|
jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
|
138
139
|
expect(spy.callCount).toEqual(0)
|
139
140
|
|
140
141
|
it "does nothing if it's not the active region", ->
|
141
142
|
Mercury.region = null
|
142
|
-
spy = spyOn(Mercury.Regions.
|
143
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'execCommand')
|
143
144
|
jasmine.simulate.keydown(document, {shiftKey: true, metaKey: true, keyCode: 90})
|
144
145
|
expect(spy.callCount).toEqual(0)
|
145
146
|
|
146
147
|
describe "mouseup", ->
|
147
148
|
|
148
149
|
it "calls focus", ->
|
149
|
-
spy = spyOn(Mercury.Regions.
|
150
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'focus')
|
150
151
|
jasmine.simulate.mouseup(@region.element.get(0))
|
151
152
|
expect(spy.callCount).toEqual(1)
|
152
153
|
|
@@ -157,7 +158,7 @@ describe "Mercury.Regions.Snippets", ->
|
|
157
158
|
|
158
159
|
it "does nothing if previewing", ->
|
159
160
|
@region.previewing = true
|
160
|
-
spy = spyOn(Mercury.Regions.
|
161
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'focus')
|
161
162
|
jasmine.simulate.mouseup(@region.element.get(0))
|
162
163
|
expect(spy.callCount).toEqual(0)
|
163
164
|
|
@@ -180,7 +181,7 @@ describe "Mercury.Regions.Snippets", ->
|
|
180
181
|
describe "#focus", ->
|
181
182
|
|
182
183
|
beforeEach ->
|
183
|
-
@region = new Mercury.Regions.
|
184
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
184
185
|
|
185
186
|
it "sets the active mercury region", ->
|
186
187
|
Mercury.region = null
|
@@ -188,19 +189,19 @@ describe "Mercury.Regions.Snippets", ->
|
|
188
189
|
expect(Mercury.region).toEqual(@region)
|
189
190
|
|
190
191
|
it "makes the snippets sortable again", ->
|
191
|
-
spy = spyOn(Mercury.Regions.
|
192
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable')
|
192
193
|
@region.focus()
|
193
194
|
expect(spy.callCount).toEqual(1)
|
194
195
|
|
195
196
|
it "adds the focus class to the element", ->
|
196
197
|
@region.focus()
|
197
|
-
expect($('#
|
198
|
+
expect($('#snippetable_region1').hasClass('focus')).toEqual(true)
|
198
199
|
|
199
200
|
|
200
201
|
describe "#togglePreview", ->
|
201
202
|
|
202
203
|
beforeEach ->
|
203
|
-
@region = new Mercury.Regions.
|
204
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
204
205
|
|
205
206
|
describe "when not previewing", ->
|
206
207
|
|
@@ -213,7 +214,7 @@ describe "Mercury.Regions.Snippets", ->
|
|
213
214
|
it "removes the focus class", ->
|
214
215
|
@regionElement.addClass('focus')
|
215
216
|
@region.togglePreview()
|
216
|
-
expect($('#
|
217
|
+
expect($('#snippetable_region1').hasClass('focus')).toEqual(false)
|
217
218
|
|
218
219
|
describe "when previewing", ->
|
219
220
|
|
@@ -221,7 +222,7 @@ describe "Mercury.Regions.Snippets", ->
|
|
221
222
|
@region.previewing = true
|
222
223
|
|
223
224
|
it "makes the snippets sortable again", ->
|
224
|
-
spy = spyOn(Mercury.Regions.
|
225
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'makeSortable')
|
225
226
|
@region.togglePreview()
|
226
227
|
expect(spy.callCount).toEqual(1)
|
227
228
|
|
@@ -229,9 +230,9 @@ describe "Mercury.Regions.Snippets", ->
|
|
229
230
|
describe "#execCommand", ->
|
230
231
|
|
231
232
|
beforeEach ->
|
232
|
-
@region = new Mercury.Regions.
|
233
|
-
Mercury.Regions.
|
234
|
-
@handlerSpy = spyOn(Mercury.Regions.
|
233
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
234
|
+
Mercury.Regions.Snippetable.actions['foo'] = ->
|
235
|
+
@handlerSpy = spyOn(Mercury.Regions.Snippetable.actions, 'foo')
|
235
236
|
|
236
237
|
it "calls a handler (from the actions) if one exists", ->
|
237
238
|
@region.execCommand('foo', {value: 'something'})
|
@@ -242,7 +243,7 @@ describe "Mercury.Regions.Snippets", ->
|
|
242
243
|
describe "#makeSortable", ->
|
243
244
|
|
244
245
|
beforeEach ->
|
245
|
-
@region = new Mercury.Regions.
|
246
|
+
@region = new Mercury.Regions.Snippetable(@regionElement, window)
|
246
247
|
@sortableSpy = spyOn($.fn, 'sortable')
|
247
248
|
|
248
249
|
it "makes the snippets sortable", ->
|
@@ -260,25 +261,26 @@ describe "Mercury.Regions.Snippets", ->
|
|
260
261
|
expect(spy.argsForCall[0]).toEqual(['hide:toolbar', {type: 'snippet', immediately: true}])
|
261
262
|
|
262
263
|
it "pushes to the history after dragging", ->
|
263
|
-
spy = spyOn(Mercury.Regions.
|
264
|
-
spyOn(window, 'setTimeout').andCallFake((
|
264
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
|
265
|
+
spyOn(window, 'setTimeout').andCallFake((timeout, callback)=> callback())
|
265
266
|
@sortableSpy.andCallFake((arg) => if arg == 'destroy' then return @region.element else arg.stop())
|
266
267
|
@region.makeSortable()
|
267
268
|
expect(spy.callCount).toEqual(1)
|
268
269
|
|
269
270
|
|
270
271
|
|
271
|
-
describe "Mercury.Regions.
|
272
|
+
describe "Mercury.Regions.Snippetable.actions", ->
|
273
|
+
|
274
|
+
template 'mercury/regions/snippetable.html'
|
272
275
|
|
273
276
|
beforeEach ->
|
274
|
-
|
275
|
-
@
|
276
|
-
@actions = Mercury.Regions.Snippets.actions
|
277
|
+
@region = new Mercury.Regions.Snippetable($('#snippetable_region2'), window)
|
278
|
+
@actions = Mercury.Regions.Snippetable.actions
|
277
279
|
|
278
280
|
describe ".undo", ->
|
279
281
|
|
280
282
|
it "calls undo on the history buffer and sets the content", ->
|
281
|
-
htmlSpy = spyOn(Mercury.Regions.
|
283
|
+
htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
|
282
284
|
historySpy = spyOn(@region.history, 'undo').andCallFake(=> 'history -1')
|
283
285
|
@actions['undo'].call(@region)
|
284
286
|
expect(historySpy.callCount).toEqual(1)
|
@@ -289,7 +291,7 @@ describe "Mercury.Regions.Snippets.actions", ->
|
|
289
291
|
describe ".redo", ->
|
290
292
|
|
291
293
|
it "calls redo on the history buffer and sets the content", ->
|
292
|
-
htmlSpy = spyOn(Mercury.Regions.
|
294
|
+
htmlSpy = spyOn(Mercury.Regions.Snippetable.prototype, 'content').andCallFake(=>)
|
293
295
|
historySpy = spyOn(@region.history, 'redo').andCallFake(=> 'history +1')
|
294
296
|
@actions['redo'].call(@region)
|
295
297
|
expect(historySpy.callCount).toEqual(1)
|
@@ -300,7 +302,6 @@ describe "Mercury.Regions.Snippets.actions", ->
|
|
300
302
|
describe ".insertSnippet", ->
|
301
303
|
|
302
304
|
beforeEach ->
|
303
|
-
Mercury.Snippet.all = []
|
304
305
|
Mercury.Snippet.load({
|
305
306
|
'snippet_1': {name: 'example', options: {'foo': 'bar'}},
|
306
307
|
'snippet_2': {name: 'example', options: {'foo': 'bar'}},
|
@@ -311,15 +312,15 @@ describe "Mercury.Regions.Snippets.actions", ->
|
|
311
312
|
|
312
313
|
it "finds the snippet by it's identity and replaces it with the new snippet", ->
|
313
314
|
@actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
|
314
|
-
expect($('#
|
315
|
-
expect($('#
|
316
|
-
expect($('#
|
317
|
-
expect($('#
|
318
|
-
expect($('#
|
315
|
+
expect($('#snippetable_region2').html()).toContain('class="mercury-snippet"')
|
316
|
+
expect($('#snippetable_region2').html()).toContain('contenteditable="false"')
|
317
|
+
expect($('#snippetable_region2').html()).toContain('data-version="1"')
|
318
|
+
expect($('#snippetable_region2').html()).toContain('data-snippet="snippet_1"')
|
319
|
+
expect($('#snippetable_region2').html()).toContain('[snippet_1]')
|
319
320
|
|
320
321
|
it "pushes to the history after it's been rendered", ->
|
321
322
|
spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
|
322
|
-
spy = spyOn(Mercury.Regions.
|
323
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
|
323
324
|
@actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
|
324
325
|
expect(spy.callCount).toEqual(1)
|
325
326
|
|
@@ -327,11 +328,11 @@ describe "Mercury.Regions.Snippets.actions", ->
|
|
327
328
|
|
328
329
|
it "appends the new snippet html to the element", ->
|
329
330
|
@actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
|
330
|
-
expect($('#
|
331
|
+
expect($('#snippetable_region2 .mercury-snippet').length).toEqual(2)
|
331
332
|
|
332
333
|
it "pushes to the history after it's been rendered", ->
|
333
334
|
spyOn(Mercury.Snippet.prototype, 'getHTML').andCallFake((x, callback) => callback() if callback)
|
334
|
-
spy = spyOn(Mercury.Regions.
|
335
|
+
spy = spyOn(Mercury.Regions.Snippetable.prototype, 'pushHistory').andCallFake(=>)
|
335
336
|
@actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_2')})
|
336
337
|
expect(spy.callCount).toEqual(1)
|
337
338
|
|
@@ -339,7 +340,7 @@ describe "Mercury.Regions.Snippets.actions", ->
|
|
339
340
|
describe ".editSnippet", ->
|
340
341
|
|
341
342
|
beforeEach ->
|
342
|
-
@region.snippet = $('#
|
343
|
+
@region.snippet = $('#snippetable_region2 .mercury-snippet')
|
343
344
|
|
344
345
|
it "finds and displays the options for the given snippet", ->
|
345
346
|
spy = spyOn(Mercury.Snippet.prototype, 'displayOptions')
|
@@ -356,11 +357,11 @@ describe "Mercury.Regions.Snippets.actions", ->
|
|
356
357
|
describe ".removeSnippet", ->
|
357
358
|
|
358
359
|
beforeEach ->
|
359
|
-
@region.snippet = $('#
|
360
|
+
@region.snippet = $('#snippetable_region2 .mercury-snippet')
|
360
361
|
|
361
362
|
it "removes the snippet if there's an active one", ->
|
362
363
|
@actions['removeSnippet'].call(@region)
|
363
|
-
expect($('#
|
364
|
+
expect($('#snippetable_region2 .mercury-snippet').length).toEqual(0)
|
364
365
|
|
365
366
|
it "triggers the hide:toolbar event", ->
|
366
367
|
spy = spyOn(Mercury, 'trigger').andCallFake(=>)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
describe "Mercury.Select", ->
|
2
2
|
|
3
|
+
template 'mercury/select.html'
|
4
|
+
|
3
5
|
beforeEach ->
|
4
|
-
fixture.load('mercury/select.html')
|
5
6
|
$.fx.off = true
|
6
7
|
|
7
8
|
afterEach ->
|
@@ -11,7 +12,7 @@ describe "Mercury.Select", ->
|
|
11
12
|
describe "#build", ->
|
12
13
|
|
13
14
|
it "builds an element", ->
|
14
|
-
@select = new Mercury.Select('/blank.html', 'foo', {appendTo:
|
15
|
+
@select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
|
15
16
|
html = $('<div>').html(@select.element).html()
|
16
17
|
expect(html).toContain('class="mercury-select mercury-foo-select loading"')
|
17
18
|
expect(html).toContain('style="display:none"')
|
@@ -24,7 +25,7 @@ describe "Mercury.Select", ->
|
|
24
25
|
describe "observed events", ->
|
25
26
|
|
26
27
|
beforeEach ->
|
27
|
-
@select = new Mercury.Select('/blank.html', 'foo', {appendTo:
|
28
|
+
@select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
|
28
29
|
|
29
30
|
it "hides", ->
|
30
31
|
@select.element.css({display: 'block'})
|
@@ -40,7 +41,7 @@ describe "Mercury.Select", ->
|
|
40
41
|
describe "#position", ->
|
41
42
|
|
42
43
|
beforeEach ->
|
43
|
-
@select = new Mercury.Select('/blank.html', 'foo', {appendTo:
|
44
|
+
@select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
|
44
45
|
|
45
46
|
it "positions based on it's button", ->
|
46
47
|
@select.element.css({display: 'block'})
|