mercury-rails 0.2.0 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/POST_INSTALL +15 -0
- data/README.md +27 -6
- data/VERSION +1 -1
- data/app/controllers/mercury_controller.rb +4 -4
- data/app/views/layouts/mercury.html.erb +14 -3
- data/app/views/mercury/panels/snippets.html +1 -1
- data/app/views/mercury/snippets/{example_options.html.erb → example/options.html.erb} +0 -0
- data/app/views/mercury/snippets/{example.html.erb → example/preview.html.erb} +0 -0
- data/config/routes.rb +2 -2
- data/features/loading/loading.feature +22 -0
- data/features/loading/navigating.feature +77 -0
- data/features/loading/user_interface.feature +67 -0
- data/features/regions/editable/advanced_editing.feature +0 -0
- data/features/regions/editable/basic_editing.feature +195 -0
- data/features/regions/editable/inserting_links.feature +98 -0
- data/features/regions/editable/inserting_media.feature +110 -0
- data/features/regions/editable/inserting_snippets.feature +103 -0
- data/features/regions/editable/inserting_special_characters.feature +24 -0
- data/features/regions/editable/inserting_tables.feature +109 -0
- data/features/regions/editable/pasting.feature +0 -0
- data/features/regions/editable/uploading_images.feature +0 -0
- data/features/regions/markupable/advanced_editing.feature +0 -0
- data/features/regions/markupable/basic_editing.feature +0 -0
- data/features/regions/markupable/inserting_links.feature +0 -0
- data/features/regions/markupable/inserting_media.feature +0 -0
- data/features/regions/markupable/inserting_snippets.feature +0 -0
- data/features/regions/markupable/inserting_special_characters.feature +0 -0
- data/features/regions/markupable/inserting_tables.feature +0 -0
- data/features/regions/markupable/uploading_images.feature +0 -0
- data/features/regions/snippetable/advanced_editing.feature +0 -0
- data/features/regions/snippetable/basic_editing.feature +0 -0
- data/features/regions/snippetable/inserting_snippets.feature +0 -0
- data/features/saving/saving.feature +33 -0
- data/features/step_definitions/debug_steps.rb +2 -2
- data/features/step_definitions/mercury_steps.rb +441 -0
- data/features/support/env.rb +3 -3
- data/features/support/mercury_contents.rb +25 -0
- data/features/support/mercury_selectors.rb +147 -0
- data/features/support/paths.rb +20 -18
- data/features/support/selectors.rb +5 -3
- data/lib/generators/mercury/install/install_generator.rb +14 -0
- data/mercury-rails.gemspec +50 -20
- data/spec/javascripts/mercury/lightview_spec.js.coffee +55 -27
- data/spec/javascripts/mercury/mercury_spec.js.coffee +3 -3
- data/spec/javascripts/mercury/modal_spec.js.coffee +2 -2
- data/spec/javascripts/mercury/native_extensions_spec.js.coffee +0 -24
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +148 -67
- data/spec/javascripts/mercury/panel_spec.js.coffee +2 -2
- data/spec/javascripts/mercury/region_spec.js.coffee +10 -7
- data/spec/javascripts/mercury/regions/editable_spec.js.coffee +0 -20
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +2 -2
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +1 -1
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +1 -1
- data/spec/javascripts/templates/mercury/page_editor.html +3 -3
- data/vendor/assets/images/mercury/close.png +0 -0
- data/vendor/assets/javascripts/mercury.js +140 -73
- data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/jquery-1.6.js +0 -0
- data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/jquery-ui-1.8.13.custom.js +0 -0
- data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/jquery.additions.js +0 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +527 -0
- data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/liquidmetal.js +0 -0
- data/vendor/assets/javascripts/{mercury_dependencies → mercury/dependencies}/showdown.js +0 -0
- data/vendor/assets/javascripts/mercury/lightview.js.coffee +5 -2
- data/vendor/assets/javascripts/mercury/mercury.js.coffee +9 -8
- data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +3 -1
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +2 -2
- data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +6 -17
- data/vendor/assets/javascripts/mercury/page_editor.js.coffee +29 -8
- data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +27 -0
- data/vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +9 -0
- data/vendor/assets/javascripts/mercury/region.js.coffee +2 -2
- data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +89 -93
- data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +1 -1
- data/vendor/assets/javascripts/mercury/support/history.js +1 -0
- data/vendor/assets/javascripts/mercury/uploader.js.coffee +0 -1
- data/vendor/assets/javascripts/mercury_loader.js +4 -4
- data/vendor/assets/stylesheets/mercury/lightview.css +8 -0
- data/vendor/assets/stylesheets/mercury/mercury.css +12 -0
- data/vendor/assets/stylesheets/mercury/modal.css +0 -12
- data/vendor/assets/stylesheets/mercury/toolbar.css +1 -0
- data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
- metadata +73 -45
- data/app/views/mercury/lightviews/imageprocessor.html +0 -3
- data/app/views/mercury/modals/sanitizer.html +0 -9
- data/features/editing/basic.feature +0 -11
- data/vendor/assets/images/mercury/clippy.png +0 -0
data/features/support/env.rb
CHANGED
@@ -9,15 +9,16 @@ require 'capybara/firebug'
|
|
9
9
|
|
10
10
|
# You can enable firebug in your tests by tagging them @firebug.
|
11
11
|
# To change the version of firebug use the FIREBUG_VERSION environment variable.
|
12
|
-
# For firefox 4 use 1.7.0
|
12
|
+
# For firefox 4+ use 1.7.0
|
13
13
|
# For firefox 3 use 1.6.2
|
14
|
-
Selenium::WebDriver::Firefox::Profile.firebug_version = ENV['FIREBUG_VERSION'] || '1.
|
14
|
+
Selenium::WebDriver::Firefox::Profile.firebug_version = ENV['FIREBUG_VERSION'] || '1.8.3'
|
15
15
|
|
16
16
|
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
17
17
|
# order to ease the transition to Capybara we set the default here. If you'd
|
18
18
|
# prefer to use XPath just remove this line and adjust any selectors in your
|
19
19
|
# steps to use the XPath syntax.
|
20
20
|
Capybara.default_selector = :css
|
21
|
+
Capybara.ignore_hidden_elements = true
|
21
22
|
|
22
23
|
# By default, any exception happening in your Rails application will bubble up
|
23
24
|
# to Cucumber so that your scenario will fail. This is a different from how
|
@@ -43,4 +44,3 @@ begin
|
|
43
44
|
rescue NameError
|
44
45
|
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
45
46
|
end
|
46
|
-
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module MercuryContentsHelpers
|
2
|
+
def contents_for(name)
|
3
|
+
case name
|
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> <b>content</b>"
|
6
|
+
when 'wrapped content' then "<span>this <a href='http://google.com'>is</a> <i>wrapped</i> <b>content</b></span>"
|
7
|
+
when 'an image' then "this is <img src='/assets/mercury/temp-logo.png'> <b>content</b>"
|
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>"
|
9
|
+
when 'the snippet', 'that snippet' then "<div class='mercury-snippet' data-snippet='#{@snippet_id || 'snippet_42'}'>#{@snippet_id || 'snippet_42'}</div> <b>content</b>"
|
10
|
+
|
11
|
+
else name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse_snippet_options_from(options_string)
|
16
|
+
json = []
|
17
|
+
options_string.scan(/(?:,\s)?([^:]*): ("[^"]*")/).each do |pair|
|
18
|
+
json << %Q{'options[#{pair[0]}]': #{pair[1]}}
|
19
|
+
end
|
20
|
+
|
21
|
+
"{#{json.join(', ')}}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
World(MercuryContentsHelpers)
|
@@ -0,0 +1,147 @@
|
|
1
|
+
module MercurySelectorsHelpers
|
2
|
+
|
3
|
+
def mercury_selector_for(locator)
|
4
|
+
case locator
|
5
|
+
|
6
|
+
# toolbar selectors
|
7
|
+
when 'the toolbar' then '.mercury-toolbar-container'
|
8
|
+
|
9
|
+
when /^the "(.*?)" button$/
|
10
|
+
".mercury-primary-toolbar .mercury-#{mercury_button_mapping_for($1)}-button"
|
11
|
+
|
12
|
+
when /^the (.*?) editor (button|dropdown|palette)$/
|
13
|
+
".mercury-editable-toolbar .mercury-#{mercury_button_mapping_for($1)}-button"
|
14
|
+
|
15
|
+
when /^the (.*?) toolbar button$/
|
16
|
+
".mercury-snippet-toolbar .mercury-#{mercury_button_mapping_for($1)}-button"
|
17
|
+
|
18
|
+
when /^the (.*?) select$/
|
19
|
+
".mercury-#{mercury_button_mapping_for($1)}-select"
|
20
|
+
|
21
|
+
when /^the (.*?) palette$/
|
22
|
+
".mercury-#{mercury_button_mapping_for($1)}-palette"
|
23
|
+
|
24
|
+
# palette / select dropdown
|
25
|
+
when 'the color red' then '.mercury-palette .picker:nth-child(22n)'
|
26
|
+
|
27
|
+
when 'the red style' then '.mercury-select-options .red'
|
28
|
+
when 'the heading 2 block' then '.mercury-select-options h2'
|
29
|
+
|
30
|
+
# statusbar selectors
|
31
|
+
when 'the statusbar' then '.mercury-statusbar'
|
32
|
+
when 'the about the editor link' then 'a.mercury-statusbar-about'
|
33
|
+
|
34
|
+
# panel selectors
|
35
|
+
when 'the panel', /^the (.*?) panel$/ then '.mercury-panel'
|
36
|
+
|
37
|
+
# modal window selectors
|
38
|
+
when 'the modal', 'the modal window', /^the (.*?) modal$/ then '.mercury-modal'
|
39
|
+
when 'the modal overlay' then '.mercury-modal-overlay'
|
40
|
+
when 'the modal title' then '.mercury-modal h1.mercury-modal-title'
|
41
|
+
when 'the modal close button' then '.mercury-modal h1.mercury-modal-title a'
|
42
|
+
|
43
|
+
when 'the sweet snowman' then '.mercury-modal .character:nth-child(247n)'
|
44
|
+
|
45
|
+
when 'the first cell in the first row' then '.mercury-modal tr:nth-child(1n) td:nth-child(1n)'
|
46
|
+
when 'the third cell in the first row' then '.mercury-modal tr:nth-child(1n) td:nth-child(3n)'
|
47
|
+
when 'the forth cell in the first row' then '.mercury-modal tr:nth-child(1n) td:nth-child(4n)'
|
48
|
+
when 'the second cell in the second row' then '.mercury-modal tr:nth-child(2n) td:nth-child(2n)'
|
49
|
+
when 'the forth cell in the second row' then '.mercury-modal tr:nth-child(2n) td:nth-child(4n)'
|
50
|
+
|
51
|
+
when 'a selected cell' then '.mercury-modal td.selected'
|
52
|
+
|
53
|
+
# lightview selectors
|
54
|
+
when 'the lightview', 'the lightview window', /^the (.*?) lightview$/ then '.mercury-lightview'
|
55
|
+
when 'the lightview overlay' then '.mercury-lightview-overlay'
|
56
|
+
when 'the lightview title' then '.mercury-lightview h1.mercury-lightview-title'
|
57
|
+
|
58
|
+
# snippet selectors
|
59
|
+
when 'the snippet toolbar' then '.mercury-snippet-toolbar'
|
60
|
+
when 'the snippet', 'that snippet' then "div[data-snippet=#{@snippet_id || 'snippet_42'}]"
|
61
|
+
|
62
|
+
# other selectors
|
63
|
+
when 'the first image' then 'img:nth-child(1n)'
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def mercury_button_mapping_for(locator)
|
69
|
+
case locator.downcase
|
70
|
+
|
71
|
+
# primary toolbar
|
72
|
+
when 'save' then 'save'
|
73
|
+
when 'preview' then 'preview'
|
74
|
+
when 'undo' then 'undo'
|
75
|
+
when 'redo' then 'redo'
|
76
|
+
when 'link', 'insert link' then 'insertLink'
|
77
|
+
when 'media', 'insert media' then 'insertMedia'
|
78
|
+
when 'table', 'insert table' then 'insertTable'
|
79
|
+
when 'character', 'insert character' then 'insertCharacter'
|
80
|
+
when 'snippet', 'insert snippet' then 'snippetPanel'
|
81
|
+
when 'history', 'view history' then 'historyPanel'
|
82
|
+
when 'notes', 'view notes' then 'notesPanel'
|
83
|
+
|
84
|
+
# editor toolbar
|
85
|
+
when 'predefined styles' then 'style'
|
86
|
+
when 'block format' then 'formatblock'
|
87
|
+
when 'backcolor', 'background color' then 'backColor'
|
88
|
+
when 'forecolor', 'foreground color' then 'foreColor'
|
89
|
+
when 'italicize' then 'italic'
|
90
|
+
when 'overline' then 'overline'
|
91
|
+
when 'strike through' then 'strikethrough'
|
92
|
+
when 'underline' then 'underline'
|
93
|
+
when 'subscript' then 'subscript'
|
94
|
+
when 'superscript' then 'superscript'
|
95
|
+
when 'justify left', 'left justify' then 'justifyLeft'
|
96
|
+
when 'justify center', 'center justify' then 'justifyCenter'
|
97
|
+
when 'justify right', 'right justify' then 'justifyRight'
|
98
|
+
when 'justify full', 'full justification' then 'justifyFull'
|
99
|
+
when 'unordered list', 'insert unordered list' then 'insertUnorderedList'
|
100
|
+
when 'ordered list', 'insert ordered list' then 'insertOrderedList'
|
101
|
+
when 'hr', 'insert hr', 'horizontal rule', 'insert horizontal rule' then 'horizontalRule'
|
102
|
+
when 'clean formatting', 'remove formatting' then 'removeFormatting'
|
103
|
+
when 'html editor' then 'htmlEditor'
|
104
|
+
|
105
|
+
# table context buttons
|
106
|
+
when 'add row before', 'insert row before' then 'insertRowBefore'
|
107
|
+
when 'add row after', 'insert row after' then 'insertRowAfter'
|
108
|
+
when 'delete row' then 'deleteRow'
|
109
|
+
when 'add column before', 'insert column before' then 'insertColumnBefore'
|
110
|
+
when 'add column after', 'insert column after' then 'insertColumnAfter'
|
111
|
+
when 'delete column' then 'deleteColumn'
|
112
|
+
when 'increase colspan' then 'increaseColspan'
|
113
|
+
when 'decrease colspan' then 'decreaseColspan'
|
114
|
+
when 'increase rowspan' then 'increaseRowspan'
|
115
|
+
when 'decrease rowspan' then 'decreaseRowspan'
|
116
|
+
|
117
|
+
# snippet toolbar
|
118
|
+
when 'edit snippet settings', 'edit snippet' then 'editSnippet'
|
119
|
+
when 'remove snippet' then 'removeSnippet'
|
120
|
+
|
121
|
+
else locator
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def region_selector_for(locator)
|
126
|
+
case locator.downcase
|
127
|
+
|
128
|
+
when 'the first editable region', 'the editable region' then '#editable1'
|
129
|
+
when 'the first markupable region', 'the markupable region', 'the markdown region' then '#markupable1'
|
130
|
+
when 'the first snippetable region', 'the first snippet region', 'the snippetable region', 'the snippet region' then '#snippetable1'
|
131
|
+
|
132
|
+
else locator
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def snippet_name_for(locator)
|
137
|
+
case locator.downcase
|
138
|
+
|
139
|
+
when 'the example snippet' then 'example'
|
140
|
+
|
141
|
+
else locator
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
World(MercurySelectorsHelpers)
|
data/features/support/paths.rb
CHANGED
@@ -8,27 +8,29 @@ module NavigationHelpers
|
|
8
8
|
def path_to(page_name)
|
9
9
|
case page_name
|
10
10
|
|
11
|
-
|
11
|
+
when 'an editable page', 'the editable page' then '/editor'
|
12
|
+
when 'the test page' then '/mercury/test_page'
|
12
13
|
|
13
|
-
when /the root( page)?/ then '/'
|
14
|
-
when /the home\s?page/ then '/'
|
15
|
-
when /the url: "(.*)"/ then url_for($1)
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# when /^(.*)'s profile page$/i
|
21
|
-
# user_profile_path(User.find_by_login($1))
|
15
|
+
when /the root( page)?/ then '/'
|
16
|
+
when /the home\s?page/ then '/'
|
17
|
+
when /the url: "(.*)"/ then url_for($1)
|
22
18
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
19
|
+
# Add more mappings here.
|
20
|
+
# Here is an example that pulls values out of the Regexp:
|
21
|
+
#
|
22
|
+
# when /^(.*)'s profile page$/i
|
23
|
+
# user_profile_path(User.find_by_login($1))
|
24
|
+
|
25
|
+
else
|
26
|
+
begin
|
27
|
+
page_name =~ /the (.*) page/
|
28
|
+
path_components = $1.split(/\s+/)
|
29
|
+
self.send(path_components.push('path').join('_').to_sym)
|
30
|
+
rescue Object => e
|
31
|
+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
32
|
+
"Now, go and add a mapping in #{__FILE__}"
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -6,10 +6,12 @@ module HtmlSelectorsHelpers
|
|
6
6
|
# step definitions in web_steps.rb
|
7
7
|
#
|
8
8
|
def selector_for(locator)
|
9
|
-
case locator
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
# add in for mercury support
|
11
|
+
result = mercury_selector_for(locator)
|
12
|
+
return result if result.present?
|
13
|
+
|
14
|
+
case locator
|
13
15
|
|
14
16
|
when /the page/
|
15
17
|
"html > body"
|
@@ -5,10 +5,24 @@ module Mercury
|
|
5
5
|
|
6
6
|
desc "Installs Mercury into your application by copying the configuration file."
|
7
7
|
|
8
|
+
class_option :full, :type => :boolean, :aliases => "-f",
|
9
|
+
:desc => 'Full installation will install the layout and css overrides for easier customization.'
|
10
|
+
|
8
11
|
def copy_config
|
9
12
|
copy_file 'vendor/assets/javascripts/mercury.js', 'app/assets/javascripts/mercury.js'
|
10
13
|
end
|
11
14
|
|
15
|
+
def copy_layout_and_css_overrides
|
16
|
+
if options[:full] || yes?("Install the layout and CSS overrides files? [yN]")
|
17
|
+
copy_file 'app/views/layouts/mercury.html.erb', 'app/views/layouts/mercury.html.erb'
|
18
|
+
copy_file 'vendor/assets/stylesheets/mercury_overrides.css', 'app/assets/stylesheets/mercury_overrides.css'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def display_readme
|
23
|
+
readme 'POST_INSTALL'
|
24
|
+
end
|
25
|
+
|
12
26
|
end
|
13
27
|
end
|
14
28
|
end
|
data/mercury-rails.gemspec
CHANGED
@@ -4,20 +4,21 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.2.
|
7
|
+
s.name = "mercury-rails"
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Jackson"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2011-10-24"
|
13
|
+
s.description = "A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript on top of Rails 3.1"
|
14
|
+
s.email = "jejacks0n@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
"LICENSE",
|
21
|
+
"POST_INSTALL",
|
21
22
|
"README.md",
|
22
23
|
"VERSION",
|
23
24
|
"annotated_source.template",
|
@@ -26,12 +27,10 @@ Gem::Specification.new do |s|
|
|
26
27
|
"app/models/image.rb",
|
27
28
|
"app/views/layouts/mercury.html.erb",
|
28
29
|
"app/views/mercury/lightviews/about.html",
|
29
|
-
"app/views/mercury/lightviews/imageprocessor.html",
|
30
30
|
"app/views/mercury/modals/character.html",
|
31
31
|
"app/views/mercury/modals/htmleditor.html",
|
32
32
|
"app/views/mercury/modals/link.html",
|
33
33
|
"app/views/mercury/modals/media.html",
|
34
|
-
"app/views/mercury/modals/sanitizer.html",
|
35
34
|
"app/views/mercury/modals/table.html",
|
36
35
|
"app/views/mercury/palettes/backcolor.html",
|
37
36
|
"app/views/mercury/palettes/forecolor.html",
|
@@ -40,15 +39,41 @@ Gem::Specification.new do |s|
|
|
40
39
|
"app/views/mercury/panels/snippets.html",
|
41
40
|
"app/views/mercury/selects/formatblock.html",
|
42
41
|
"app/views/mercury/selects/style.html",
|
43
|
-
"app/views/mercury/snippets/example.html.erb",
|
44
|
-
"app/views/mercury/snippets/
|
42
|
+
"app/views/mercury/snippets/example/options.html.erb",
|
43
|
+
"app/views/mercury/snippets/example/preview.html.erb",
|
45
44
|
"config/engine.rb",
|
46
45
|
"config/routes.rb",
|
47
46
|
"db/migrate/20110526035601_create_images.rb",
|
48
|
-
"features/
|
47
|
+
"features/loading/loading.feature",
|
48
|
+
"features/loading/navigating.feature",
|
49
|
+
"features/loading/user_interface.feature",
|
50
|
+
"features/regions/editable/advanced_editing.feature",
|
51
|
+
"features/regions/editable/basic_editing.feature",
|
52
|
+
"features/regions/editable/inserting_links.feature",
|
53
|
+
"features/regions/editable/inserting_media.feature",
|
54
|
+
"features/regions/editable/inserting_snippets.feature",
|
55
|
+
"features/regions/editable/inserting_special_characters.feature",
|
56
|
+
"features/regions/editable/inserting_tables.feature",
|
57
|
+
"features/regions/editable/pasting.feature",
|
58
|
+
"features/regions/editable/uploading_images.feature",
|
59
|
+
"features/regions/markupable/advanced_editing.feature",
|
60
|
+
"features/regions/markupable/basic_editing.feature",
|
61
|
+
"features/regions/markupable/inserting_links.feature",
|
62
|
+
"features/regions/markupable/inserting_media.feature",
|
63
|
+
"features/regions/markupable/inserting_snippets.feature",
|
64
|
+
"features/regions/markupable/inserting_special_characters.feature",
|
65
|
+
"features/regions/markupable/inserting_tables.feature",
|
66
|
+
"features/regions/markupable/uploading_images.feature",
|
67
|
+
"features/regions/snippetable/advanced_editing.feature",
|
68
|
+
"features/regions/snippetable/basic_editing.feature",
|
69
|
+
"features/regions/snippetable/inserting_snippets.feature",
|
70
|
+
"features/saving/saving.feature",
|
49
71
|
"features/step_definitions/debug_steps.rb",
|
72
|
+
"features/step_definitions/mercury_steps.rb",
|
50
73
|
"features/step_definitions/web_steps.rb",
|
51
74
|
"features/support/env.rb",
|
75
|
+
"features/support/mercury_contents.rb",
|
76
|
+
"features/support/mercury_selectors.rb",
|
52
77
|
"features/support/paths.rb",
|
53
78
|
"features/support/selectors.rb",
|
54
79
|
"lib/generators/mercury/install/install_generator.rb",
|
@@ -123,7 +148,7 @@ Gem::Specification.new do |s|
|
|
123
148
|
"spec/javascripts/templates/mercury/tooltip.html",
|
124
149
|
"spec/javascripts/templates/mercury/uploader.html",
|
125
150
|
"vendor/assets/images/mercury/button.png",
|
126
|
-
"vendor/assets/images/mercury/
|
151
|
+
"vendor/assets/images/mercury/close.png",
|
127
152
|
"vendor/assets/images/mercury/default-snippet.png",
|
128
153
|
"vendor/assets/images/mercury/loading-dark.gif",
|
129
154
|
"vendor/assets/images/mercury/loading-light.gif",
|
@@ -146,6 +171,12 @@ Gem::Specification.new do |s|
|
|
146
171
|
"vendor/assets/images/mercury/toolbar/primary/undo.png",
|
147
172
|
"vendor/assets/images/mercury/toolbar/snippetable/buttons.png",
|
148
173
|
"vendor/assets/javascripts/mercury.js",
|
174
|
+
"vendor/assets/javascripts/mercury/dependencies/jquery-1.6.js",
|
175
|
+
"vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js",
|
176
|
+
"vendor/assets/javascripts/mercury/dependencies/jquery.additions.js",
|
177
|
+
"vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js",
|
178
|
+
"vendor/assets/javascripts/mercury/dependencies/liquidmetal.js",
|
179
|
+
"vendor/assets/javascripts/mercury/dependencies/showdown.js",
|
149
180
|
"vendor/assets/javascripts/mercury/dialog.js.coffee",
|
150
181
|
"vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee",
|
151
182
|
"vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee",
|
@@ -167,6 +198,8 @@ Gem::Specification.new do |s|
|
|
167
198
|
"vendor/assets/javascripts/mercury/page_editor.js.coffee",
|
168
199
|
"vendor/assets/javascripts/mercury/palette.js.coffee",
|
169
200
|
"vendor/assets/javascripts/mercury/panel.js.coffee",
|
201
|
+
"vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee",
|
202
|
+
"vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js",
|
170
203
|
"vendor/assets/javascripts/mercury/region.js.coffee",
|
171
204
|
"vendor/assets/javascripts/mercury/regions/editable.js.coffee",
|
172
205
|
"vendor/assets/javascripts/mercury/regions/markupable.js.coffee",
|
@@ -175,6 +208,7 @@ Gem::Specification.new do |s|
|
|
175
208
|
"vendor/assets/javascripts/mercury/snippet.js.coffee",
|
176
209
|
"vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee",
|
177
210
|
"vendor/assets/javascripts/mercury/statusbar.js.coffee",
|
211
|
+
"vendor/assets/javascripts/mercury/support/history.js",
|
178
212
|
"vendor/assets/javascripts/mercury/table_editor.js.coffee",
|
179
213
|
"vendor/assets/javascripts/mercury/toolbar.button.js.coffee",
|
180
214
|
"vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee",
|
@@ -182,11 +216,6 @@ Gem::Specification.new do |s|
|
|
182
216
|
"vendor/assets/javascripts/mercury/toolbar.js.coffee",
|
183
217
|
"vendor/assets/javascripts/mercury/tooltip.js.coffee",
|
184
218
|
"vendor/assets/javascripts/mercury/uploader.js.coffee",
|
185
|
-
"vendor/assets/javascripts/mercury_dependencies/jquery-1.6.js",
|
186
|
-
"vendor/assets/javascripts/mercury_dependencies/jquery-ui-1.8.13.custom.js",
|
187
|
-
"vendor/assets/javascripts/mercury_dependencies/jquery.additions.js",
|
188
|
-
"vendor/assets/javascripts/mercury_dependencies/liquidmetal.js",
|
189
|
-
"vendor/assets/javascripts/mercury_dependencies/showdown.js",
|
190
219
|
"vendor/assets/javascripts/mercury_loader.js",
|
191
220
|
"vendor/assets/stylesheets/mercury.css",
|
192
221
|
"vendor/assets/stylesheets/mercury/dialog.css",
|
@@ -196,13 +225,14 @@ Gem::Specification.new do |s|
|
|
196
225
|
"vendor/assets/stylesheets/mercury/statusbar.css",
|
197
226
|
"vendor/assets/stylesheets/mercury/toolbar.css",
|
198
227
|
"vendor/assets/stylesheets/mercury/tooltip.css",
|
199
|
-
"vendor/assets/stylesheets/mercury/uploader.css"
|
228
|
+
"vendor/assets/stylesheets/mercury/uploader.css",
|
229
|
+
"vendor/assets/stylesheets/mercury_overrides.css"
|
200
230
|
]
|
201
|
-
s.homepage =
|
231
|
+
s.homepage = "http://github.com/jejacks0n/mercury"
|
202
232
|
s.licenses = ["MIT"]
|
203
233
|
s.require_paths = ["lib"]
|
204
|
-
s.rubygems_version =
|
205
|
-
s.summary =
|
234
|
+
s.rubygems_version = "1.8.10"
|
235
|
+
s.summary = "A fully featured and advanced HTML5 WYSIWYG editor written in CoffeeScript on top of Rails 3.1"
|
206
236
|
|
207
237
|
if s.respond_to? :specification_version then
|
208
238
|
s.specification_version = 3
|
@@ -11,8 +11,8 @@ describe "Mercury.lightview", ->
|
|
11
11
|
afterEach ->
|
12
12
|
Mercury.lightview.initialized = false
|
13
13
|
Mercury.lightview.visible = false
|
14
|
-
$(
|
15
|
-
$(
|
14
|
+
$(window).unbind('mercury:refresh')
|
15
|
+
$(window).unbind('mercury:resize')
|
16
16
|
$(document).unbind('keydown')
|
17
17
|
|
18
18
|
describe "singleton method", ->
|
@@ -119,47 +119,75 @@ describe "Mercury.lightview", ->
|
|
119
119
|
Mercury.lightview.build()
|
120
120
|
expect($('#test .mercury-lightview-title span').html()).toEqual('title')
|
121
121
|
|
122
|
+
it "creates a close button if asked to in the options", ->
|
123
|
+
Mercury.lightview.options.closeButton = true
|
124
|
+
Mercury.lightview.build()
|
125
|
+
expect($('#test .mercury-lightview-close').length).toEqual(1)
|
126
|
+
|
122
127
|
|
123
128
|
describe "observed events", ->
|
124
129
|
|
125
130
|
beforeEach ->
|
126
131
|
spyOn(Mercury.lightview, 'appear').andCallFake(=>)
|
127
|
-
Mercury.lightview('/foo', {appendTo: $('#test')})
|
128
132
|
|
129
|
-
describe "
|
133
|
+
describe "without a close button", ->
|
130
134
|
|
131
|
-
|
132
|
-
|
133
|
-
Mercury.trigger('refresh')
|
134
|
-
expect(spy.callCount).toEqual(1)
|
135
|
-
expect(spy.argsForCall[0]).toEqual([true])
|
135
|
+
beforeEach ->
|
136
|
+
Mercury.lightview('/foo', {appendTo: $('#test')})
|
136
137
|
|
137
|
-
|
138
|
+
describe "custom event: refresh", ->
|
138
139
|
|
139
|
-
|
140
|
-
|
140
|
+
it "calls resize telling it stay visible", ->
|
141
|
+
spy = spyOn(Mercury.lightview, 'resize').andCallFake(=>)
|
142
|
+
Mercury.trigger('refresh')
|
143
|
+
expect(spy.callCount).toEqual(1)
|
144
|
+
expect(spy.argsForCall[0]).toEqual([true])
|
141
145
|
|
142
|
-
|
143
|
-
spy = spyOn(Mercury.lightview, 'position').andCallFake(=>)
|
144
|
-
Mercury.trigger('resize')
|
145
|
-
expect(spy.callCount).toEqual(1)
|
146
|
+
describe "custom event: resize", ->
|
146
147
|
|
147
|
-
|
148
|
+
beforeEach ->
|
149
|
+
Mercury.lightview.visible = true
|
148
150
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
151
|
+
it "calls position", ->
|
152
|
+
spy = spyOn(Mercury.lightview, 'position').andCallFake(=>)
|
153
|
+
Mercury.trigger('resize')
|
154
|
+
expect(spy.callCount).toEqual(1)
|
155
|
+
|
156
|
+
describe "clicking on the overlay", ->
|
157
|
+
|
158
|
+
it "calls hide", ->
|
159
|
+
spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
|
160
|
+
jasmine.simulate.click($('.mercury-lightview-overlay').get(0))
|
161
|
+
expect(spy.callCount).toEqual(1)
|
153
162
|
|
154
|
-
|
163
|
+
describe "pressing esc on document", ->
|
164
|
+
|
165
|
+
beforeEach ->
|
166
|
+
Mercury.lightview.visible = true
|
167
|
+
|
168
|
+
it "calls hide", ->
|
169
|
+
spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
|
170
|
+
jasmine.simulate.keydown(document, {keyCode: 27})
|
171
|
+
expect(spy.callCount).toEqual(1)
|
172
|
+
|
173
|
+
describe "with a close button", ->
|
155
174
|
|
156
175
|
beforeEach ->
|
157
|
-
Mercury.lightview
|
176
|
+
Mercury.lightview('/foo', {appendTo: $('#test'), closeButton: true})
|
158
177
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
178
|
+
describe "clicking on the close button", ->
|
179
|
+
|
180
|
+
it "calls hide", ->
|
181
|
+
spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
|
182
|
+
jasmine.simulate.click($('.mercury-lightview-close').get(0))
|
183
|
+
expect(spy.callCount).toEqual(1)
|
184
|
+
|
185
|
+
describe "clicking on the overlay", ->
|
186
|
+
|
187
|
+
it "doesn't call hide", ->
|
188
|
+
spy = spyOn(Mercury.lightview, 'hide').andCallFake(=>)
|
189
|
+
jasmine.simulate.click($('.mercury-lightview-overlay').get(0))
|
190
|
+
expect(spy.callCount).toEqual(0)
|
163
191
|
|
164
192
|
|
165
193
|
describe "#appear", ->
|