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
@@ -0,0 +1,109 @@
|
|
1
|
+
@javascript
|
2
|
+
Feature:
|
3
|
+
As a content editor type person
|
4
|
+
In order to manage content
|
5
|
+
I should be able to insert and edit complex tables
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am on an editable page
|
9
|
+
And the editor won't prompt when leaving the page
|
10
|
+
|
11
|
+
Scenario: A user can expect all this!
|
12
|
+
|
13
|
+
|
14
|
+
# Scenario: A user can insert a table
|
15
|
+
Given the content of the editable region is simple content
|
16
|
+
And I make a selection
|
17
|
+
|
18
|
+
When I click on the "Insert Table" button
|
19
|
+
Then the modal window should be visible
|
20
|
+
And I should see "Insert Table" within the modal title
|
21
|
+
|
22
|
+
When I click on the third cell in the first row
|
23
|
+
And I add a column before it
|
24
|
+
Then the table column count should be 4
|
25
|
+
And the selected cell should be the forth cell in the first row
|
26
|
+
|
27
|
+
When I add a column after
|
28
|
+
Then the table column count should be 5
|
29
|
+
And the selected cell should be the forth cell in the first row
|
30
|
+
|
31
|
+
When I add a row after
|
32
|
+
Then the table row count should be 3
|
33
|
+
And the selected cell should be the forth cell in the first row
|
34
|
+
|
35
|
+
When I add a row before
|
36
|
+
Then the table row count should be 4
|
37
|
+
And the selected cell should be the forth cell in the second row
|
38
|
+
|
39
|
+
When I delete the column
|
40
|
+
Then the table column count should be 4
|
41
|
+
And a selected cell should not be visible
|
42
|
+
|
43
|
+
When I click on the second cell in the second row
|
44
|
+
And delete the row
|
45
|
+
Then the table row count should be 3
|
46
|
+
And a selected cell should not be visible
|
47
|
+
|
48
|
+
When I click on the second cell in the second row
|
49
|
+
And increase the colspan
|
50
|
+
And click on the first cell in the first row
|
51
|
+
And increase the rowspan
|
52
|
+
And select "Right" from "Alignment"
|
53
|
+
And fill in "Border" with "2"
|
54
|
+
And fill in "Spacing" with "2"
|
55
|
+
And press "Insert Table"
|
56
|
+
Then the contents of the editable region should be "this is <table align='right' border='2' cellspacing='2'><tbody><tr><td rowspan='2'><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td colspan='2'><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr></tbody></table> <b>content</b>"
|
57
|
+
And the modal window should not be visible
|
58
|
+
|
59
|
+
|
60
|
+
# Scenario: A user can edit a table after inserting one (in an editable region)
|
61
|
+
Given the content of the editable region has a table
|
62
|
+
And I make a selection
|
63
|
+
|
64
|
+
When I click on the add row before editor button
|
65
|
+
Then the table row count should be 3
|
66
|
+
And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td></tr><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
67
|
+
|
68
|
+
When I click on the add row after editor button
|
69
|
+
Then the table row count should be 4
|
70
|
+
And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td></tr><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><br></td><td><br></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
71
|
+
|
72
|
+
When I click on the add column before editor button
|
73
|
+
Then the column count should be 3
|
74
|
+
And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>1</span></td><td><span>2</span></td></tr><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
75
|
+
|
76
|
+
When I click on the add column after editor button
|
77
|
+
Then the column count should be 4
|
78
|
+
And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>1</span></td><td><br></td><td><span>2</span></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>3</span></td><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
79
|
+
|
80
|
+
When I click on the delete row editor button
|
81
|
+
Then the table row count should be 3
|
82
|
+
And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><span>3</span></td><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
83
|
+
|
84
|
+
When I make a selection
|
85
|
+
And click on the delete column editor button
|
86
|
+
Then the table column count should be 3
|
87
|
+
And the contents of the editable region should be "this is a <table><tbody><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
88
|
+
|
89
|
+
|
90
|
+
# Scenario: A user can adjust the colspans of a table (in an editable region)
|
91
|
+
Given the content of the editable region has a table
|
92
|
+
And I make a selection
|
93
|
+
|
94
|
+
When I click on the increase colspan editor button
|
95
|
+
Then the contents of the editable region should be "this is a <table><tbody><tr><td colspan='2'><span>1</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
96
|
+
|
97
|
+
When I click on the decrease colspan editor button
|
98
|
+
Then the contents of the editable region should be "this is a <table><tbody><tr><td><span>1</span></td><td><br></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
99
|
+
|
100
|
+
|
101
|
+
# Scenario: A user can adjust the rowspans of a table (in an editable region)
|
102
|
+
Given the content of the editable region has a table
|
103
|
+
And I make a selection
|
104
|
+
|
105
|
+
When I click on the increase rowspan editor button
|
106
|
+
Then the contents of the editable region should be "this is a <table><tbody><tr><td rowspan='2'><span>1</span></td><td><span>2</span></td></tr><tr><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
107
|
+
|
108
|
+
When I click on the decrease rowspan editor button
|
109
|
+
Then the contents of the editable region should be "this is a <table><tbody><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><br></td><td><span>4</span></td></tr></tbody></table> <b>content</b>"
|
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
|
File without changes
|
File without changes
|
@@ -9,19 +9,19 @@ Feature:
|
|
9
9
|
And save results will be cached
|
10
10
|
|
11
11
|
|
12
|
-
Scenario: A user can change content in
|
13
|
-
When I set the content of the
|
12
|
+
Scenario: A user can change content in an editable region and save those changes
|
13
|
+
When I set the content of the editable region to "new content"
|
14
14
|
And I click on the "Save" button
|
15
|
-
Then the save should have "new content" for the
|
15
|
+
Then the save should have "new content" for the editable region
|
16
16
|
|
17
17
|
|
18
|
-
Scenario: A user can change content in a
|
19
|
-
When I set the content of the
|
18
|
+
Scenario: A user can change content in a markupable region and save those changes
|
19
|
+
When I set the content of the markupable region to "new content"
|
20
20
|
And I click on the "Save" button
|
21
|
-
Then the save should have "new content" for the
|
21
|
+
Then the save should have "new content" for the markupable region
|
22
22
|
|
23
23
|
|
24
|
-
Scenario: A user can put snippets into
|
24
|
+
Scenario: A user can put snippets into an editable region and get the options on save
|
25
25
|
# todo: finish
|
26
26
|
|
27
27
|
|
@@ -29,5 +29,5 @@ Feature:
|
|
29
29
|
# todo: finish
|
30
30
|
|
31
31
|
|
32
|
-
Scenario: A user can put snippets into a
|
32
|
+
Scenario: A user can put snippets into a markupable region and get the options on save
|
33
33
|
# todo: finish
|
@@ -1 +1,438 @@
|
|
1
|
-
|
1
|
+
## Generic web steps
|
2
|
+
#------------------------------------------------------------------------------
|
3
|
+
When /^(?:|I )click on (.+)$/ do |locator|
|
4
|
+
selector = selector_for(locator)
|
5
|
+
find(selector, :message => "Unable to locate the element '#{selector}' to click on").click
|
6
|
+
end
|
7
|
+
|
8
|
+
Then /^(.+) should (not )?be visible$/ do |locator, boolean|
|
9
|
+
selector = selector_for(locator)
|
10
|
+
if boolean == 'not '
|
11
|
+
page.has_no_css?("#{selector}")
|
12
|
+
else
|
13
|
+
page.has_css?("#{selector}", :visible => true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# scoping step for different windows
|
18
|
+
When /^(.*) in the "([^"]*)" window$/ do |s, window|
|
19
|
+
page.driver.within_window(window) do
|
20
|
+
step(s)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
## Mercury general steps
|
26
|
+
#------------------------------------------------------------------------------
|
27
|
+
Given /^(?:|I )adjust the configuration to have: \{([^\}]*)\}$/ do |javascript|
|
28
|
+
Rails.application.config.mercury_config = JSON.parse("{#{javascript}}")
|
29
|
+
end
|
30
|
+
|
31
|
+
# scoping step for the mercury content frame
|
32
|
+
When /^(.*) in the content frame$/ do |s|
|
33
|
+
page.driver.within_frame('mercury_iframe') do
|
34
|
+
step(s)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# silence mercury's onbeforeunload confirmation
|
39
|
+
Given /^the editor won't prompt when leaving the page$/ do
|
40
|
+
page.driver.execute_script('Mercury.silent = true;')
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
## Toolbar specific steps
|
45
|
+
#------------------------------------------------------------------------------
|
46
|
+
# for the select dropdowns
|
47
|
+
When /^(?:|I )select (.*?) from the dropdown$/ do |locator|
|
48
|
+
selector = selector_for(locator)
|
49
|
+
find(selector, :message => "Unable to locate the element '#{selector}' to click on").click
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
## Panel specific steps
|
54
|
+
#------------------------------------------------------------------------------
|
55
|
+
When /^(?:I )(?:open|close|toggle) the (.*?) panel$/ do |panel_locator|
|
56
|
+
step(%Q{I click on the "#{panel_locator}" button})
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
## Modal specific steps
|
61
|
+
#------------------------------------------------------------------------------
|
62
|
+
When /^(?:I )close the modal(?: window)?$/ do
|
63
|
+
step(%Q{I click on the modal close button})
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
## Region specific steps
|
68
|
+
#------------------------------------------------------------------------------
|
69
|
+
# setting content
|
70
|
+
Given /^the content of (.*?) (?:is|are|has|includes) (.*?)$/ do |region_locator, contents|
|
71
|
+
step(%Q{I set the contents of #{region_locator} to #{contents}})
|
72
|
+
end
|
73
|
+
|
74
|
+
When /^(?:|I )(?:change|set) the contents? of (.*?) to (.*?)$/ do |region_locator, contents|
|
75
|
+
region_id = region_selector_for(region_locator).gsub('#', '')
|
76
|
+
content = contents[0] == '"' ? contents : "\"#{contents_for(contents)}\""
|
77
|
+
page.driver.within_frame('mercury_iframe') do
|
78
|
+
find("##{region_id}", :message => "Unable to locate a region matching '##{region_id}'")
|
79
|
+
page.driver.execute_script <<-JAVASCRIPT
|
80
|
+
var element = top.jQuery(document).find('##{region_id}');
|
81
|
+
if (element.data('type') == 'markupable') {
|
82
|
+
element.find('textarea').val(#{content});
|
83
|
+
} else {
|
84
|
+
var region = top.mercuryInstance.getRegionByName('#{region_id}');
|
85
|
+
region.content(#{content});
|
86
|
+
}
|
87
|
+
JAVASCRIPT
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# setting/making selections
|
92
|
+
When /^(?:|I )(?:make|have) a selection$/ do
|
93
|
+
step(%Q{I have a selection for "span"})
|
94
|
+
end
|
95
|
+
|
96
|
+
When /^(?:|I )(?:make|have) a selection (?:in (.*?) )?for "([^"]*)"$/ do |region_locator, selector|
|
97
|
+
step(%Q{I can simulate complex javascript events})
|
98
|
+
# assume the first editable region if one wasn't provided'
|
99
|
+
region_selector = region_selector_for(region_locator || 'the editable region')
|
100
|
+
page.driver.within_frame('mercury_iframe') do
|
101
|
+
find("#{region_selector}", :message => "Unable to locate a region matching '#{region_selector}'")
|
102
|
+
find("#{region_selector} #{selector}", :message => "Unable to locate a match for '#{selector}' inside '#{region_locator}'")
|
103
|
+
page.driver.execute_script <<-JAVASCRIPT
|
104
|
+
var element = top.jQuery(document).find('#{region_selector}');
|
105
|
+
if (element.data('type') == 'markupable') {
|
106
|
+
alert('unimplemented');
|
107
|
+
throw('unimplemented');
|
108
|
+
} else {
|
109
|
+
var selectedElement = element.find('#{selector}');
|
110
|
+
var selection = new top.Mercury.Regions.Editable.Selection(window.getSelection(), document);
|
111
|
+
selection.selectNode(selectedElement.get(0));
|
112
|
+
selectedElement.simulate('mouseup');
|
113
|
+
}
|
114
|
+
JAVASCRIPT
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# other events
|
119
|
+
When /^(?:|I )double click on (.*?) in (.*?)$/ do |locator, region_locator|
|
120
|
+
step(%Q{I can simulate complex javascript events})
|
121
|
+
selector = selector_for(locator)
|
122
|
+
# assume the first editable region if one wasn't provided'
|
123
|
+
region_selector = region_selector_for(region_locator || 'the editable region')
|
124
|
+
page.driver.within_frame('mercury_iframe') do
|
125
|
+
find("#{region_selector}", :message => "Unable to locate a region matching '#{region_selector}'")
|
126
|
+
find("#{region_selector} #{selector}", :message => "Unable to locate a match for '#{selector}' inside '#{region_locator}'")
|
127
|
+
page.driver.execute_script <<-JAVASCRIPT
|
128
|
+
top.jQuery(document).find('#{region_selector} #{selector}').simulate('dblclick');
|
129
|
+
JAVASCRIPT
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# getting contents
|
134
|
+
Then /^the contents? of (.*?) should be "([^"]*)"$/ do |region_locator, content|
|
135
|
+
region_selector = region_selector_for(region_locator)
|
136
|
+
page.driver.within_frame('mercury_iframe') do
|
137
|
+
find("#{region_selector}", :message => "Unable to locate a region matching '#{region_selector}'")
|
138
|
+
results = page.driver.execute_script <<-JAVASCRIPT
|
139
|
+
var element = top.jQuery(document).find('#{region_selector}');
|
140
|
+
if (element.data('type') == 'markupable') {
|
141
|
+
return element.find('textarea').val();
|
142
|
+
} else {
|
143
|
+
return element.html();
|
144
|
+
}
|
145
|
+
JAVASCRIPT
|
146
|
+
assert_equal content, results.gsub('"', "'").gsub("\n", '')
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
## Saving specific steps
|
152
|
+
#------------------------------------------------------------------------------
|
153
|
+
# caching for the last save -- a request will still be made
|
154
|
+
Given /^save results will be cached$/ do
|
155
|
+
page.driver.execute_script <<-JAVASCRIPT
|
156
|
+
Mercury.PageEditor.prototype.save = function() {
|
157
|
+
window.cachedResults = this.serialize();
|
158
|
+
}
|
159
|
+
JAVASCRIPT
|
160
|
+
end
|
161
|
+
|
162
|
+
# check for the last save cached results
|
163
|
+
Then /^the save should have (.*?) for (.*?)$/ do |contents, region_locator|
|
164
|
+
region_id = region_selector_for(region_locator).gsub('#', '')
|
165
|
+
content = contents[0] == '"' ? contents : "\"#{contents_for(contents)}\""
|
166
|
+
results = page.driver.execute_script <<-JAVASCRIPT
|
167
|
+
return (window.cachedResults['#{region_id}']) ?
|
168
|
+
window.cachedResults['#{region_id}']['value'] : null;
|
169
|
+
JAVASCRIPT
|
170
|
+
assert_equal content, "\"#{results}\""
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
## Table editing specific steps
|
175
|
+
#------------------------------------------------------------------------------
|
176
|
+
# in the modal window
|
177
|
+
When /^(?:|I )(?:add|insert) a (row|column) (before|after)(?: it)?$/ do |row_or_column, before_or_after|
|
178
|
+
name = "insert_#{row_or_column}_#{before_or_after}".camelcase(:lower)
|
179
|
+
step(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
|
180
|
+
end
|
181
|
+
|
182
|
+
When /^(?:|I )delete the(?: current)? (row|column)$/ do |row_or_column|
|
183
|
+
name = "delete_#{row_or_column}".camelcase(:lower)
|
184
|
+
step(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
|
185
|
+
end
|
186
|
+
|
187
|
+
When /^(?:|I )(increase|decrease) the (rowspan|colspan)$/ do |increase_or_decrease, rowspan_or_colspan|
|
188
|
+
name = "#{increase_or_decrease}_#{rowspan_or_colspan}".camelcase(:lower)
|
189
|
+
step(%Q{I click on ".mercury-modal-content input[name=#{name}]"})
|
190
|
+
end
|
191
|
+
|
192
|
+
Then /^the selected cell should be (.*?)$/ do |locator|
|
193
|
+
selector = selector_for(locator).gsub('td:', 'td.selected:')
|
194
|
+
find("#{selector}", :message => "Unable to locate the selected cell for '#{selector}'")
|
195
|
+
end
|
196
|
+
|
197
|
+
# in general
|
198
|
+
Then /^the(?: table)? (row|column) count should be (\d+)$/ do |row_or_column, expected_count|
|
199
|
+
method = "get_#{row_or_column}_count".camelcase(:lower)
|
200
|
+
actual_count = page.driver.execute_script("return Mercury.tableEditor.#{method}()")
|
201
|
+
assert_equal expected_count.to_i, actual_count.to_i
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
## Snippet specific steps
|
206
|
+
#------------------------------------------------------------------------------
|
207
|
+
# setting snippet options
|
208
|
+
Given /^the options for the (.*?) snippet "([^"]*)" are (.*?)$/ do |snippet_name, snippet_id, options|
|
209
|
+
@snippet_id = snippet_id
|
210
|
+
options_json = parse_snippet_options_from(options)
|
211
|
+
page.driver.execute_script <<-JAVASCRIPT
|
212
|
+
Mercury.Snippet.load({#{snippet_id}: {name: '#{snippet_name}', options: #{options_json}}});
|
213
|
+
JAVASCRIPT
|
214
|
+
end
|
215
|
+
|
216
|
+
# dragging/dropping
|
217
|
+
When /^(?:|I )(?:drag|drop) (.*?) (?:into|on) (.*?)$/ do |snippet_locator, region_locator|
|
218
|
+
snippet_name = snippet_name_for(snippet_locator)
|
219
|
+
region_id = region_selector_for(region_locator).gsub('#', '')
|
220
|
+
page.driver.within_frame('mercury_iframe') do
|
221
|
+
find("##{region_id}", :message => "Unable to locate a region matching '##{region_id}'")
|
222
|
+
page.driver.execute_script <<-JAVASCRIPT
|
223
|
+
var element = top.jQuery(document).find('##{region_id}');
|
224
|
+
if (element.data('type') == 'markupable') {
|
225
|
+
alert('unimplemented');
|
226
|
+
throw('unimplemented');
|
227
|
+
} else {
|
228
|
+
var region = top.mercuryInstance.getRegionByName('#{region_id}');
|
229
|
+
region.selection().range.collapse(true);
|
230
|
+
document.execCommand('insertHTML', false, '<img data-snippet="#{snippet_name}" src="/assets/mercury/default-snippet.png">');
|
231
|
+
element.trigger('possible:drop');
|
232
|
+
}
|
233
|
+
JAVASCRIPT
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
When /^(?:|I )hover over (.*?)(?: in (.*?))?$/ do |locator, region_locator|
|
238
|
+
step(%Q{I can simulate complex javascript events})
|
239
|
+
selector = selector_for(locator)
|
240
|
+
region_selector = region_selector_for(region_locator || 'the editable region')
|
241
|
+
page.driver.within_frame('mercury_iframe') do
|
242
|
+
find("#{region_selector}", :message => "Unable to locate a region matching '#{region_selector}'")
|
243
|
+
page.driver.execute_script <<-JAVASCRIPT
|
244
|
+
var element = top.jQuery(document).find('#{region_selector}');
|
245
|
+
if (element.data('type') == 'markupable') {
|
246
|
+
alert('unimplemented');
|
247
|
+
throw('unimplemented');
|
248
|
+
} else {
|
249
|
+
element.find('#{selector}').simulate('mousemove');
|
250
|
+
}
|
251
|
+
JAVASCRIPT
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
When /^(?:|I )edit the snippet$/ do
|
256
|
+
step(%{I hover over the snippet})
|
257
|
+
step(%{click on the edit snippet settings toolbar button})
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
## Dropping image specific steps
|
262
|
+
#------------------------------------------------------------------------------
|
263
|
+
#When /^(?:|I )drop an image into (.*?) from a different browser/ do |region_locator|
|
264
|
+
# Given(%Q{I can simulate complex javascript events})
|
265
|
+
# region_selector = region_selector_for(region_locator || 'the editable region')
|
266
|
+
# page.driver.within_frame('mercury_iframe') do
|
267
|
+
# find("#{region_selector}", :message => "Unable to locate a region matching '#{region_selector}'")
|
268
|
+
# page.driver.execute_script <<-JAVASCRIPT
|
269
|
+
# var element = top.jQuery(document).find('#{region_selector}');
|
270
|
+
# if (element.data('type') == 'markupable') {
|
271
|
+
# alert('unimplemented');
|
272
|
+
# throw('unimplemented');
|
273
|
+
# } else {
|
274
|
+
# element.find('#{region_selector}').simulate('drop', {'text/html': '<img src="testing.gif"/>'});
|
275
|
+
# }
|
276
|
+
# JAVASCRIPT
|
277
|
+
# end
|
278
|
+
#end
|
279
|
+
|
280
|
+
|
281
|
+
## Javascript event simulation steps
|
282
|
+
#------------------------------------------------------------------------------
|
283
|
+
Given /^(?:|I )can simulate complex javascript events$/ do
|
284
|
+
page.driver.execute_script(EVENT_SIMULATION_JAVASCRIPT)
|
285
|
+
end
|
286
|
+
|
287
|
+
#------------------------------------------------------------------------------
|
288
|
+
|
289
|
+
EVENT_SIMULATION_JAVASCRIPT = <<-JAVASCRIPT
|
290
|
+
/*
|
291
|
+
* jquery.simulate - simulate browser mouse and keyboard events
|
292
|
+
*
|
293
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
294
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
295
|
+
* http://jquery.org/license
|
296
|
+
*
|
297
|
+
*/
|
298
|
+
;(function($) {
|
299
|
+
|
300
|
+
$.fn.extend({
|
301
|
+
simulate: function(type, options) {
|
302
|
+
return this.each(function() {
|
303
|
+
var opt = $.extend({}, $.simulate.defaults, options || {});
|
304
|
+
new $.simulate(this, type, opt);
|
305
|
+
});
|
306
|
+
}
|
307
|
+
});
|
308
|
+
|
309
|
+
$.simulate = function(el, type, options) {
|
310
|
+
this.target = el;
|
311
|
+
this.options = options;
|
312
|
+
|
313
|
+
if (/^drag$/.test(type)) {
|
314
|
+
this[type].apply(this, [this.target, options]);
|
315
|
+
} else {
|
316
|
+
this.simulateEvent(el, type, options);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
$.extend($.simulate.prototype, {
|
321
|
+
simulateEvent: function(el, type, options) {
|
322
|
+
var evt = this.createEvent(type, options);
|
323
|
+
this.dispatchEvent(el, type, evt, options);
|
324
|
+
return evt;
|
325
|
+
},
|
326
|
+
createEvent: function(type, options) {
|
327
|
+
if (/^mouse(over|out|down|up|move)|(dbl)?click$/.test(type)) {
|
328
|
+
return this.mouseEvent(type, options);
|
329
|
+
} else if (/^key(up|down|press)$/.test(type)) {
|
330
|
+
return this.keyboardEvent(type, options);
|
331
|
+
}
|
332
|
+
},
|
333
|
+
mouseEvent: function(type, options) {
|
334
|
+
var evt;
|
335
|
+
var e = $.extend({
|
336
|
+
bubbles: true, cancelable: (type != "mousemove"), view: window, detail: 0,
|
337
|
+
screenX: 0, screenY: 0, clientX: 0, clientY: 0,
|
338
|
+
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
339
|
+
button: 0, relatedTarget: undefined
|
340
|
+
}, options);
|
341
|
+
|
342
|
+
var relatedTarget = $(e.relatedTarget)[0];
|
343
|
+
|
344
|
+
if ($.isFunction(document.createEvent)) {
|
345
|
+
evt = document.createEvent("MouseEvents");
|
346
|
+
evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
|
347
|
+
e.screenX, e.screenY, e.clientX, e.clientY,
|
348
|
+
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
|
349
|
+
e.button, e.relatedTarget || document.body.parentNode);
|
350
|
+
} else if (document.createEventObject) {
|
351
|
+
evt = document.createEventObject();
|
352
|
+
$.extend(evt, e);
|
353
|
+
evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button;
|
354
|
+
}
|
355
|
+
return evt;
|
356
|
+
},
|
357
|
+
keyboardEvent: function(type, options) {
|
358
|
+
var evt;
|
359
|
+
|
360
|
+
var e = $.extend({ bubbles: true, cancelable: true, view: window,
|
361
|
+
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
362
|
+
keyCode: 0, charCode: 0
|
363
|
+
}, options);
|
364
|
+
|
365
|
+
if ($.isFunction(document.createEvent)) {
|
366
|
+
try {
|
367
|
+
evt = document.createEvent("KeyEvents");
|
368
|
+
evt.initKeyEvent(type, e.bubbles, e.cancelable, e.view,
|
369
|
+
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
|
370
|
+
e.keyCode, e.charCode);
|
371
|
+
} catch(err) {
|
372
|
+
evt = document.createEvent("Events");
|
373
|
+
evt.initEvent(type, e.bubbles, e.cancelable);
|
374
|
+
$.extend(evt, { view: e.view,
|
375
|
+
ctrlKey: e.ctrlKey, altKey: e.altKey, shiftKey: e.shiftKey, metaKey: e.metaKey,
|
376
|
+
keyCode: e.keyCode, charCode: e.charCode
|
377
|
+
});
|
378
|
+
}
|
379
|
+
} else if (document.createEventObject) {
|
380
|
+
evt = document.createEventObject();
|
381
|
+
$.extend(evt, e);
|
382
|
+
}
|
383
|
+
if ($.browser.msie || $.browser.opera) {
|
384
|
+
evt.keyCode = (e.charCode > 0) ? e.charCode : e.keyCode;
|
385
|
+
evt.charCode = undefined;
|
386
|
+
}
|
387
|
+
return evt;
|
388
|
+
},
|
389
|
+
dispatchEvent: function(el, type, evt) {
|
390
|
+
if (el.dispatchEvent) {
|
391
|
+
el.dispatchEvent(evt);
|
392
|
+
} else if (el.fireEvent) {
|
393
|
+
el.fireEvent('on' + type, evt);
|
394
|
+
}
|
395
|
+
return evt;
|
396
|
+
},
|
397
|
+
drag: function(el) {
|
398
|
+
var self = this, center = this.findCenter(this.target),
|
399
|
+
options = this.options, x = Math.floor(center.x), y = Math.floor(center.y),
|
400
|
+
dx = options.dx || 0, dy = options.dy || 0, target = this.target;
|
401
|
+
var coord = { clientX: x, clientY: y };
|
402
|
+
this.simulateEvent(target, "mousedown", coord);
|
403
|
+
coord = { clientX: x + 1, clientY: y + 1 };
|
404
|
+
this.simulateEvent(document, "mousemove", coord);
|
405
|
+
coord = { clientX: x + dx, clientY: y + dy };
|
406
|
+
this.simulateEvent(document, "mousemove", coord);
|
407
|
+
this.simulateEvent(document, "mousemove", coord);
|
408
|
+
this.simulateEvent(target, "mouseup", coord);
|
409
|
+
this.simulateEvent(target, "click", coord);
|
410
|
+
},
|
411
|
+
findCenter: function(el) {
|
412
|
+
var el = $(this.target), o = el.offset(), d = $(document);
|
413
|
+
return {
|
414
|
+
x: o.left + el.outerWidth() / 2 - d.scrollLeft(),
|
415
|
+
y: o.top + el.outerHeight() / 2 - d.scrollTop()
|
416
|
+
};
|
417
|
+
}
|
418
|
+
});
|
419
|
+
|
420
|
+
$.extend($.simulate, {
|
421
|
+
defaults: {
|
422
|
+
speed: 'sync'
|
423
|
+
},
|
424
|
+
VK_TAB: 9,
|
425
|
+
VK_ENTER: 13,
|
426
|
+
VK_ESC: 27,
|
427
|
+
VK_PGUP: 33,
|
428
|
+
VK_PGDN: 34,
|
429
|
+
VK_END: 35,
|
430
|
+
VK_HOME: 36,
|
431
|
+
VK_LEFT: 37,
|
432
|
+
VK_UP: 38,
|
433
|
+
VK_RIGHT: 39,
|
434
|
+
VK_DOWN: 40
|
435
|
+
});
|
436
|
+
|
437
|
+
})(jQuery);
|
438
|
+
JAVASCRIPT
|
data/features/support/env.rb
CHANGED
@@ -4,16 +4,14 @@
|
|
4
4
|
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
5
|
# files.
|
6
6
|
|
7
|
-
ENV["RAILS_ROOT"] = File.expand_path('../../../spec/dummy', __FILE__)
|
8
7
|
require 'cucumber/rails'
|
9
8
|
require 'capybara/firebug'
|
10
|
-
require 'aruba/cucumber'
|
11
9
|
|
12
10
|
# You can enable firebug in your tests by tagging them @firebug.
|
13
11
|
# To change the version of firebug use the FIREBUG_VERSION environment variable.
|
14
12
|
# For firefox 4+ use 1.7.0
|
15
13
|
# For firefox 3 use 1.6.2
|
16
|
-
|
14
|
+
Selenium::WebDriver::Firefox::Profile.firebug_version = ENV['FIREBUG_VERSION'] || '1.8.3'
|
17
15
|
|
18
16
|
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
19
17
|
# order to ease the transition to Capybara we set the default here. If you'd
|
@@ -46,11 +44,3 @@ begin
|
|
46
44
|
rescue NameError
|
47
45
|
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
48
46
|
end
|
49
|
-
|
50
|
-
Before('@use_hidden_elements') do
|
51
|
-
Capybara.ignore_hidden_elements = false
|
52
|
-
end
|
53
|
-
|
54
|
-
After('@use_hidden_elements') do
|
55
|
-
Capybara.ignore_hidden_elements = true
|
56
|
-
end
|
@@ -2,7 +2,7 @@ module MercuryContentsHelpers
|
|
2
2
|
def contents_for(name)
|
3
3
|
case name
|
4
4
|
when 'simple content' then "this is <span>simple</span> <b>content</b>"
|
5
|
-
when 'justifiable content' then "<div>first line</div><br/>this is <span>justifiable</span
|
5
|
+
when 'justifiable content' then "<div>first line</div><br/>this is <span>justifiable</span> <b>content</b>"
|
6
6
|
when 'wrapped content' then "<span>this <a href='http://google.com'>is</a> <i>wrapped</i> <b>content</b></span>"
|
7
7
|
when 'an image' then "this is <img src='/assets/mercury/temp-logo.png'> <b>content</b>"
|
8
8
|
when 'a table' then "this is a <table><tr><td><span>1</span></td><td><span>2</span></td></tr><tr><td><span>3</span></td><td><span>4</span></td></tr></table> <b>content</b>"
|
@@ -15,11 +15,11 @@ module MercuryContentsHelpers
|
|
15
15
|
def parse_snippet_options_from(options_string)
|
16
16
|
json = []
|
17
17
|
options_string.scan(/(?:,\s)?([^:]*): ("[^"]*")/).each do |pair|
|
18
|
-
json << %Q{'#{pair[0]}': #{pair[1]}}
|
18
|
+
json << %Q{'options[#{pair[0]}]': #{pair[1]}}
|
19
19
|
end
|
20
20
|
|
21
21
|
"{#{json.join(', ')}}"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
World(MercuryContentsHelpers)
|
25
|
+
World(MercuryContentsHelpers)
|