rwiki 0.1.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. data/Capfile +2 -0
  2. data/Gemfile +30 -0
  3. data/Rakefile +22 -65
  4. data/VERSION +1 -1
  5. data/config.ru +11 -0
  6. data/config/config.yml.example +1 -0
  7. data/config/deploy.rb +37 -0
  8. data/features/create_page.feature +30 -20
  9. data/features/delete_page.feature +23 -18
  10. data/features/display_page.feature +10 -11
  11. data/features/editor.feature +45 -0
  12. data/features/history.feature +46 -0
  13. data/features/rename_page.feature +42 -37
  14. data/features/step_definitions/common_steps.rb +19 -47
  15. data/features/step_definitions/common_transforms.rb +5 -0
  16. data/features/step_definitions/dialog_box_steps.rb +16 -0
  17. data/features/step_definitions/history_steps.rb +11 -0
  18. data/features/step_definitions/tab_panel_steps.rb +27 -0
  19. data/features/step_definitions/tree_panel_steps.rb +42 -0
  20. data/features/step_definitions/wait_steps.rb +21 -0
  21. data/features/support/env.rb +6 -0
  22. data/features/tab_panel.feature +47 -0
  23. data/features/tree_panel.feature +14 -15
  24. data/lib/rwiki.rb +1 -0
  25. data/lib/rwiki/app.rb +14 -2
  26. data/lib/rwiki/models/folder.rb +1 -1
  27. data/lib/rwiki/models/node.rb +11 -1
  28. data/lib/rwiki/models/page.rb +1 -1
  29. data/public/favicon.ico +0 -0
  30. data/public/images/compressed.png +0 -0
  31. data/public/images/css.png +0 -0
  32. data/public/images/file.png +0 -0
  33. data/public/images/html.png +0 -0
  34. data/public/images/icon_word.png +0 -0
  35. data/public/images/image.png +0 -0
  36. data/public/images/javascript.png +0 -0
  37. data/public/images/pdf.png +0 -0
  38. data/public/images/php.png +0 -0
  39. data/public/images/presentation.png +0 -0
  40. data/public/images/ruby.png +0 -0
  41. data/public/images/shellscript.png +0 -0
  42. data/public/images/stylesheet.png +0 -0
  43. data/public/images/text.png +0 -0
  44. data/public/images/wordprocessing.png +0 -0
  45. data/public/javascripts/Rwiki.js +71 -29
  46. data/public/javascripts/Rwiki/EditorPanel.js +5 -37
  47. data/public/javascripts/Rwiki/EditorPanel/Editor.js +8 -44
  48. data/public/javascripts/Rwiki/EditorWindow.js +66 -0
  49. data/public/javascripts/Rwiki/FuzzyFinderDialog.js +61 -0
  50. data/public/javascripts/Rwiki/NavigationPanel.js +25 -0
  51. data/public/javascripts/Rwiki/NodeManager.js +2 -0
  52. data/public/javascripts/Rwiki/TabPanel.js +39 -2
  53. data/public/javascripts/Rwiki/TreePanel.js +39 -26
  54. data/public/javascripts/Rwiki/TreePanel/Menu.js +1 -1
  55. data/public/javascripts/Rwiki/TreePanel/Node.js +46 -0
  56. data/public/javascripts/vendor/ext/adapter/ext/ext-base-debug.js +836 -710
  57. data/public/javascripts/vendor/ext/adapter/ext/ext-base.js +5 -5
  58. data/public/javascripts/vendor/ext/adapter/jquery/ext-jquery-adapter-debug.js +47 -700
  59. data/public/javascripts/vendor/ext/adapter/jquery/ext-jquery-adapter.js +5 -5
  60. data/public/javascripts/vendor/ext/adapter/prototype/ext-prototype-adapter-debug.js +45 -698
  61. data/public/javascripts/vendor/ext/adapter/prototype/ext-prototype-adapter.js +5 -5
  62. data/public/javascripts/vendor/ext/adapter/yui/ext-yui-adapter-debug.js +39 -696
  63. data/public/javascripts/vendor/ext/adapter/yui/ext-yui-adapter.js +5 -5
  64. data/public/javascripts/vendor/ext/ext-all-debug-w-comments.js +17932 -12860
  65. data/public/javascripts/vendor/ext/ext-all-debug.js +11674 -8102
  66. data/public/javascripts/vendor/ext/ext-all.js +6 -6
  67. data/public/javascripts/vendor/ext/ux/StatusBar.js +418 -0
  68. data/public/resources/ext/charts.swf +0 -0
  69. data/public/resources/ext/css/debug.css +4 -4
  70. data/public/resources/ext/css/ext-all-notheme.css +204 -52
  71. data/public/resources/ext/css/ext-all.css +234 -54
  72. data/public/resources/ext/css/reset-min.css +4 -4
  73. data/public/resources/ext/css/structure/borders.css +4 -4
  74. data/public/resources/ext/css/structure/box.css +4 -4
  75. data/public/resources/ext/css/structure/button.css +7 -7
  76. data/public/resources/ext/css/structure/combo.css +4 -4
  77. data/public/resources/ext/css/structure/core.css +15 -5
  78. data/public/resources/ext/css/structure/date-picker.css +4 -4
  79. data/public/resources/ext/css/structure/dd.css +4 -4
  80. data/public/resources/ext/css/structure/debug.css +4 -4
  81. data/public/resources/ext/css/structure/dialog.css +6 -9
  82. data/public/resources/ext/css/structure/editor.css +4 -4
  83. data/public/resources/ext/css/structure/form.css +14 -4
  84. data/public/resources/ext/css/structure/grid.css +15 -5
  85. data/public/resources/ext/css/structure/layout.css +7 -7
  86. data/public/resources/ext/css/structure/list-view.css +4 -4
  87. data/public/resources/ext/css/structure/menu.css +13 -6
  88. data/public/resources/ext/css/structure/panel-reset.css +4 -4
  89. data/public/resources/ext/css/structure/panel.css +70 -22
  90. data/public/resources/ext/css/structure/pivotgrid.css +65 -0
  91. data/public/resources/ext/css/structure/progress.css +4 -4
  92. data/public/resources/ext/css/structure/qtips.css +4 -4
  93. data/public/resources/ext/css/structure/reset.css +11 -5
  94. data/public/resources/ext/css/structure/resizable.css +4 -4
  95. data/public/resources/ext/css/structure/slider.css +4 -4
  96. data/public/resources/ext/css/structure/tabs.css +13 -8
  97. data/public/resources/ext/css/structure/toolbar.css +5 -5
  98. data/public/resources/ext/css/structure/tree.css +11 -11
  99. data/public/resources/ext/css/structure/window.css +5 -5
  100. data/public/resources/ext/css/theme-access/borders.css +4 -4
  101. data/public/resources/ext/css/theme-access/box.css +4 -4
  102. data/public/resources/ext/css/theme-access/button.css +4 -4
  103. data/public/resources/ext/css/theme-access/combo.css +4 -4
  104. data/public/resources/ext/css/theme-access/core.css +4 -4
  105. data/public/resources/ext/css/theme-access/date-picker.css +4 -4
  106. data/public/resources/ext/css/theme-access/dd.css +4 -4
  107. data/public/resources/ext/css/theme-access/debug.css +4 -4
  108. data/public/resources/ext/css/theme-access/dialog.css +4 -4
  109. data/public/resources/ext/css/theme-access/editor.css +4 -4
  110. data/public/resources/ext/css/theme-access/form.css +4 -4
  111. data/public/resources/ext/css/theme-access/grid.css +4 -4
  112. data/public/resources/ext/css/theme-access/layout.css +4 -4
  113. data/public/resources/ext/css/theme-access/list-view.css +8 -4
  114. data/public/resources/ext/css/theme-access/menu.css +4 -4
  115. data/public/resources/ext/css/theme-access/panel.css +4 -4
  116. data/public/resources/ext/css/theme-access/progress.css +4 -4
  117. data/public/resources/ext/css/theme-access/qtips.css +4 -4
  118. data/public/resources/ext/css/theme-access/resizable.css +4 -4
  119. data/public/resources/ext/css/theme-access/slider.css +4 -4
  120. data/public/resources/ext/css/theme-access/tabs.css +4 -4
  121. data/public/resources/ext/css/theme-access/toolbar.css +4 -4
  122. data/public/resources/ext/css/theme-access/tree.css +4 -4
  123. data/public/resources/ext/css/theme-access/window.css +5 -5
  124. data/public/resources/ext/css/theme-gray/borders.css +4 -4
  125. data/public/resources/ext/css/theme-gray/box.css +4 -4
  126. data/public/resources/ext/css/theme-gray/button.css +4 -4
  127. data/public/resources/ext/css/theme-gray/combo.css +4 -4
  128. data/public/resources/ext/css/theme-gray/core.css +6 -4
  129. data/public/resources/ext/css/theme-gray/date-picker.css +4 -4
  130. data/public/resources/ext/css/theme-gray/dd.css +4 -4
  131. data/public/resources/ext/css/theme-gray/debug.css +4 -4
  132. data/public/resources/ext/css/theme-gray/dialog.css +4 -4
  133. data/public/resources/ext/css/theme-gray/editor.css +4 -4
  134. data/public/resources/ext/css/theme-gray/form.css +4 -4
  135. data/public/resources/ext/css/theme-gray/grid.css +10 -6
  136. data/public/resources/ext/css/theme-gray/layout.css +4 -4
  137. data/public/resources/ext/css/theme-gray/list-view.css +5 -5
  138. data/public/resources/ext/css/theme-gray/menu.css +4 -4
  139. data/public/resources/ext/css/theme-gray/panel.css +4 -4
  140. data/public/resources/ext/css/theme-gray/pivotgrid.css +28 -0
  141. data/public/resources/ext/css/theme-gray/progress.css +4 -4
  142. data/public/resources/ext/css/theme-gray/qtips.css +4 -4
  143. data/public/resources/ext/css/theme-gray/resizable.css +4 -4
  144. data/public/resources/ext/css/theme-gray/slider.css +4 -4
  145. data/public/resources/ext/css/theme-gray/tabs.css +4 -4
  146. data/public/resources/ext/css/theme-gray/toolbar.css +4 -4
  147. data/public/resources/ext/css/theme-gray/tree.css +4 -4
  148. data/public/resources/ext/css/theme-gray/window.css +4 -4
  149. data/public/resources/ext/css/visual/borders.css +4 -4
  150. data/public/resources/ext/css/visual/box.css +4 -4
  151. data/public/resources/ext/css/visual/button.css +4 -4
  152. data/public/resources/ext/css/visual/combo.css +4 -4
  153. data/public/resources/ext/css/visual/core.css +6 -4
  154. data/public/resources/ext/css/visual/date-picker.css +4 -4
  155. data/public/resources/ext/css/visual/dd.css +4 -4
  156. data/public/resources/ext/css/visual/debug.css +4 -4
  157. data/public/resources/ext/css/visual/dialog.css +4 -4
  158. data/public/resources/ext/css/visual/editor.css +4 -4
  159. data/public/resources/ext/css/visual/form.css +4 -4
  160. data/public/resources/ext/css/visual/grid.css +8 -4
  161. data/public/resources/ext/css/visual/layout.css +4 -4
  162. data/public/resources/ext/css/visual/list-view.css +4 -4
  163. data/public/resources/ext/css/visual/menu.css +4 -4
  164. data/public/resources/ext/css/visual/panel.css +4 -4
  165. data/public/resources/ext/css/visual/pivotgrid.css +28 -0
  166. data/public/resources/ext/css/visual/progress.css +4 -4
  167. data/public/resources/ext/css/visual/qtips.css +4 -4
  168. data/public/resources/ext/css/visual/resizable.css +4 -4
  169. data/public/resources/ext/css/visual/slider.css +4 -4
  170. data/public/resources/ext/css/visual/tabs.css +4 -4
  171. data/public/resources/ext/css/visual/toolbar.css +5 -5
  172. data/public/resources/ext/css/visual/tree.css +4 -4
  173. data/public/resources/ext/css/visual/window.css +4 -4
  174. data/public/resources/ext/css/xtheme-access.css +9 -5
  175. data/public/resources/ext/css/xtheme-blue.css +34 -6
  176. data/public/resources/ext/css/xtheme-gray.css +35 -7
  177. data/public/resources/ext/css/yourtheme.css +11 -5
  178. data/public/resources/ext/images/access/panel/tool-sprites.gif +0 -0
  179. data/public/resources/ext/images/default/grid/grid3-rowheader.gif +0 -0
  180. data/public/resources/ext/images/default/grid/refresh-disabled.gif +0 -0
  181. data/public/resources/ext/images/default/panel/tool-sprites.gif +0 -0
  182. data/public/resources/ext/images/gray/grid/sort-hd.gif +0 -0
  183. data/public/resources/ext/images/gray/panel/tool-sprites.gif +0 -0
  184. data/public/resources/ext/images/gray/window/left-corners.png +0 -0
  185. data/public/resources/ext/images/gray/window/left-right.png +0 -0
  186. data/public/resources/ext/images/gray/window/right-corners.png +0 -0
  187. data/public/resources/ext/images/gray/window/top-bottom.png +0 -0
  188. data/public/stylesheets/coderay.css +3 -0
  189. data/public/stylesheets/markitup.css +19 -0
  190. data/public/stylesheets/style.css +1 -1
  191. data/run_tests.sh +1 -0
  192. data/rwiki.gemspec +56 -37
  193. data/test/fixtures/pages/Info/dummy +0 -0
  194. data/test/rwiki/models/test_folder.rb +4 -4
  195. data/vendor/.gitkeep +0 -0
  196. data/views/layout.erb +13 -5
  197. metadata +78 -69
  198. data/.idea/projectCodeStyle.xml +0 -80
  199. data/.rvmrc +0 -1
  200. data/public/javascripts/Rwiki/SidePanel.js +0 -26
  201. data/public/javascripts/Rwiki/Toolbar.js +0 -31
  202. data/public/javascripts/Rwiki/Viewport.js +0 -10
  203. data/tmp/ExtDesigner/MyViewport.js +0 -18
  204. data/tmp/ExtDesigner/MyViewport.ui.js +0 -29
  205. data/tmp/ExtDesigner/Rwiki.EditorPanel.js +0 -19
  206. data/tmp/ExtDesigner/Rwiki.EditorPanel.ui.js +0 -27
  207. data/tmp/ExtDesigner/Rwiki.MainPanel.js +0 -19
  208. data/tmp/ExtDesigner/Rwiki.MainPanel.ui.js +0 -29
  209. data/tmp/ExtDesigner/Rwiki.TabPane.PageTab.js +0 -19
  210. data/tmp/ExtDesigner/Rwiki.TabPane.PageTab.ui.js +0 -19
  211. data/tmp/ExtDesigner/Rwiki.TabPanel.js +0 -19
  212. data/tmp/ExtDesigner/Rwiki.TabPanel.ui.js +0 -27
  213. data/tmp/ExtDesigner/Rwiki.TreePanel.js +0 -19
  214. data/tmp/ExtDesigner/Rwiki.TreePanel.ui.js +0 -27
  215. data/tmp/ExtDesigner/Rwiki.Viewport.js +0 -18
  216. data/tmp/ExtDesigner/Rwiki.Viewport.ui.js +0 -30
  217. data/tmp/ExtDesigner/rwiki.xds +0 -192
  218. data/tmp/ExtDesigner/xds_includeOrder.txt +0 -12
  219. data/tmp/ExtDesigner/xds_index.html +0 -26
  220. data/tmp/ExtDesigner/xds_index.js +0 -19
@@ -1,81 +1,86 @@
1
1
  Feature: Rename a node
2
2
 
3
3
  Background:
4
- Given I go to the home page
5
- And I wait for ajax call complete
4
+ Given I open the application
6
5
 
7
6
  @javascript
8
7
  Scenario: Rename a page
9
- When I right click node "./home.txt"
8
+ When I right click the node with path "./home.txt"
10
9
  And I follow "Rename node"
11
10
  Then I should see dialog box titled "Rename node"
12
11
 
13
- When I fill in the dialog box input with "The new home"
14
- And press "OK"
15
- And I reload the page
16
- And I should see "The new home"
12
+ When I fill in the input with "The new home" within the dialog box
13
+ And I press "OK" within the dialog box
14
+ Then I should see the node titled "The new home"
17
15
 
18
- When I click node "./The new home.txt"
19
- And I wait for ajax call complete
16
+ When I reload the application
17
+ Then I should see the node titled "The new home"
18
+
19
+ When I click the node with path "./The new home.txt"
20
20
  Then I should see "Sample page" within "h1"
21
21
 
22
22
  @javascript
23
23
  Scenario: Rename a page to existing name
24
- When I right click node "./home.txt"
24
+ When I right click the node with path "./home.txt"
25
25
  And I follow "Rename node"
26
26
  Then I should see dialog box titled "Rename node"
27
27
 
28
- When I fill in the dialog box input with "test"
29
- And press "OK"
30
- And I reload the page
28
+ When I fill in the input with "test" within the dialog box
29
+ And I press "OK" within the dialog box
30
+ And I reload the application
31
31
  And I should see "home"
32
32
  And I should see "test"
33
33
 
34
- When I click node "./home.txt"
35
- And I wait for ajax call complete
34
+ When I click the node with path "./home.txt"
36
35
  Then I should see "Sample page" within "h1"
37
36
 
38
- When I click node "./test.txt"
39
- And I wait for ajax call complete
37
+ When I click the node with path "./test.txt"
40
38
  Then I should see "This is a test"
39
+ And I should see page title "Rwiki ./test.txt"
41
40
  And I should have the following open tabs:
42
41
  | home |
43
42
  | test |
44
43
 
45
44
  @javascript
46
45
  Scenario: Rename a page when tab is open
47
- When I click node "./home.txt"
48
- And I click node "./test.txt"
49
- And I right click node "./home.txt"
46
+ When I click the node with path "./test.txt"
47
+ And I click the node with path "./home.txt"
48
+ Then I should see page title "Rwiki ./home.txt"
49
+
50
+ And I right click the node with path "./home.txt"
50
51
  And I follow "Rename node"
51
52
  Then I should see dialog box titled "Rename node"
52
53
 
53
- When I fill in the dialog box input with "The new home"
54
- And press "OK"
55
- Then I should have the following open tabs:
56
- | The new home |
54
+ When I fill in the input with "The new home" within the dialog box
55
+ And I press "OK" within the dialog box
56
+ Then I should see the node titled "The new home"
57
+ And I should have the following open tabs:
57
58
  | test |
59
+ | The new home |
60
+ And I should see page title "Rwiki ./The new home.txt"
58
61
 
59
62
  @javascript
60
63
  Scenario: Rename a folder
61
- When I right click node "./folder"
64
+ When I double click the node with path "./folder"
65
+ And I click the node with path "./folder/test.txt"
66
+ Then I should see page title "Rwiki ./folder/test.txt"
67
+
68
+ When I right click the node with path "./folder"
62
69
  And I follow "Rename node"
63
70
  Then I should see dialog box titled "Rename node"
64
71
 
65
- When I fill in the dialog box input with "The new folder name"
66
- And press "OK"
67
- Then I should see "The new folder name"
72
+ When I fill in the input with "The new folder name" within the dialog box
73
+ And I press "OK" within the dialog box
74
+ Then I should see the node titled "The new folder name"
75
+ Then I should see page title "Rwiki ./The new folder name/test.txt"
68
76
 
69
- When I double click node "./The new folder name"
70
- And I click node "./The new folder name/test.txt"
71
- And I wait for ajax call complete
77
+ When I double click the node with path "./The new folder name"
78
+ And I click the node with path "./The new folder name/test.txt"
72
79
  Then I should see "Test 1" within "h3"
73
80
 
74
- When I reload the page
75
- And I wait for ajax call complete
76
- And I double click node "./The new folder name"
77
- And I click node "./The new folder name/test.txt"
78
- And I wait for ajax call complete
81
+ When I reload the application
82
+ Then I should see the node titled "The new folder name"
83
+ And I double click the node with path "./The new folder name"
84
+ And I click the node with path "./The new folder name/test.txt"
79
85
  Then I should see "Test 1" within "h3"
80
-
81
86
 
@@ -1,64 +1,36 @@
1
- When /^I wait for (\d+) second$/ do |n|
2
- sleep(n.to_i)
1
+ Then /^I enter the break point$/ do
2
+ debugger
3
+ p 'debugger'
3
4
  end
4
5
 
5
- When /^I reload the page$/ do
6
+ When /^I open the application$/ do
6
7
  When %Q{I go to the home page}
7
- And %Q{I wait for ajax call complete}
8
8
  end
9
9
 
10
- Given /^I wait for ajax call complete$/ do
11
- timeout = 10
12
- wait_until(timeout) do
13
- ajax_in_progress = Capybara.current_session.evaluate_script <<-JS
14
- Rwiki.ajaxCallInProgress
15
- JS
16
-
17
- !ajax_in_progress
18
- end
19
- end
20
-
21
- When /^I double click node "([^"]*)"$/ do |path|
22
- node_id = Capybara.current_session.evaluate_script <<-JS
23
- Rwiki.treePanel.findNodeByPath('#{path}').id
24
- JS
25
-
26
- Capybara.current_session.execute_script <<-JS
27
- $("div[ext\\\\:tree-node-id='#{node_id}']").trigger("dblclick")
28
- JS
29
- end
30
-
31
- When /^I click node "([^"]*)"$/ do |path|
32
- node_id = Capybara.current_session.evaluate_script <<-JS
33
- Rwiki.treePanel.findNodeByPath('#{path}').id
34
- JS
35
-
10
+ When /^I reload the application$/ do
36
11
  Capybara.current_session.execute_script <<-JS
37
- $("div[ext\\\\:tree-node-id='#{node_id}']").trigger("click")
12
+ window.location.reload();
38
13
  JS
39
14
  end
40
15
 
41
- When /^I right click node "([^"]*)"$/ do |path|
42
- Capybara.current_session.execute_script <<-JS
43
- var node = Rwiki.treePanel.findNodeByPath('#{path}')
44
- Rwiki.treePanel.fireEvent('contextmenu', node, { getXY: function() { return [0,0] } })
45
- JS
16
+ When /^I open the application for page with path "([^"]*)"$/ do |path|
17
+ visit('/#' + path)
46
18
  end
47
19
 
48
- Then /^I should have the following open tabs:$/ do |table|
49
- actual_table = table(tableish("div.x-tab-panel ul li[@class!='x-tab-edge']", "a.x-tab-right"))
50
- table.diff!(actual_table)
20
+ Then /^I should see dialog box titled "([^"]*)"$/ do |title|
21
+ %Q{Then I should see "#{title}" within "span.x-window-header-text"}
51
22
  end
52
23
 
53
- Then /^I should have no open tabs$/ do
54
- page.all("div.x-tab-panel ul li[class!='x-tab-edge']").size.should == 0
24
+ Then /^I should see page title "([^"]*)"$/ do |title|
25
+ find("title").text.should == title
55
26
  end
56
27
 
57
- Then /^I should see dialog box titled "([^"]*)"$/ do |title|
58
- %Q{Then I should see "#{title}" within "span.x-window-header-text"}
59
- end
28
+ When /^I create a new page title "([^"]*)" for the node with path "([^"]*)"$/ do |title, path|
29
+ When %{I right click the node with path "#{path}"}
30
+ And %{I follow "Create page"}
31
+ Then %{I should see dialog box titled "Create page"}
60
32
 
61
- When /^I fill in the dialog box input with "([^"]*)"$/ do |text|
62
- field = find("div.x-window-dlg input")
63
- field.set(text)
33
+ When %{I fill in the input with "#{title}" within the dialog box}
34
+ And %{I press "OK" within the dialog box}
35
+ Then %{I should see the node titled "#{title}"}
64
36
  end
@@ -0,0 +1,5 @@
1
+ Transform /^the node with path "([^"]*)"$/ do |path|
2
+ Capybara.current_session.evaluate_script <<-JS
3
+ Rwiki.treePanel.findNodeByPath('#{path}').id;
4
+ JS
5
+ end
@@ -0,0 +1,16 @@
1
+ When /^I fill in the input with "([^"]*)" within the dialog box$/ do |text|
2
+ field = find('div.x-window-dlg input')
3
+ field.set(text)
4
+ end
5
+
6
+ When /^I press "([^"]*)" within the dialog box$/ do |button|
7
+ When %{I press "#{button}" within "div.x-window-dlg"}
8
+ end
9
+
10
+ Then /^I should see the window titled "([^"]*)"$/ do |title|
11
+ page.find("span.x-window-header-text").text.should == title
12
+ end
13
+
14
+ Then /^I should not see the window$/ do
15
+ page.should have_no_css('div.x-window', :visible => true)
16
+ end
@@ -0,0 +1,11 @@
1
+ When /^I press the browser back button$/ do
2
+ Capybara.current_session.evaluate_script <<-JS
3
+ history.back();
4
+ JS
5
+ end
6
+
7
+ When /^I press the browser forward button$/ do
8
+ Capybara.current_session.evaluate_script <<-JS
9
+ history.forward();
10
+ JS
11
+ end
@@ -0,0 +1,27 @@
1
+ When /^I close tab for page "([^"]*)"$/ do |path|
2
+ tab_id = Capybara.current_session.evaluate_script <<-JS
3
+ Rwiki.tabPanel.findTabByPagePath('#{path}').tabEl.id;
4
+ JS
5
+
6
+ close_button = find("li##{tab_id} a.x-tab-strip-close")
7
+ # TODO try fix this workaround see http://groups.google.com/group/ruby-capybara/browse_thread/thread/985b123dc98d27b5
8
+ close_button.click rescue nil
9
+ end
10
+
11
+ When /^I click tab for page "([^"]*)"$/ do |path|
12
+ tab_id = Capybara.current_session.evaluate_script <<-JS
13
+ Rwiki.tabPanel.findTabByPagePath('#{path}').tabEl.id;
14
+ JS
15
+
16
+ tab = find("li##{tab_id}")
17
+ tab.click
18
+ end
19
+
20
+ Then /^I should have the following open tabs:$/ do |table|
21
+ actual_table = table(tableish("div.x-tab-panel ul li[@class!='x-tab-edge']", "a.x-tab-right"))
22
+ table.diff!(actual_table)
23
+ end
24
+
25
+ Then /^I should have no open tabs$/ do
26
+ page.all("div.x-tab-panel ul li[class!='x-tab-edge']").size.should == 0
27
+ end
@@ -0,0 +1,42 @@
1
+ Then /^I should see the node titled "([^"]*)"$/ do |title|
2
+ Then %{I should see "#{title}" within "div#tree"}
3
+ end
4
+
5
+ Then /^I should not see the node titled "([^"]*)"$/ do |title|
6
+ Then %{I should not see "#{title}" within "div#tree"}
7
+ end
8
+
9
+ When /^I double click (the node with path "(?:[^"]*)")$/ do |tree_node_id|
10
+ Capybara.current_session.execute_script <<-JS
11
+ $("div[ext\\\\:tree-node-id='#{tree_node_id}']").trigger("dblclick")
12
+ JS
13
+ end
14
+
15
+ When /^I click (the node with path "(?:[^"]*)")$/ do |tree_node_id|
16
+ Capybara.current_session.execute_script <<-JS
17
+ $("div[ext\\\\:tree-node-id='#{tree_node_id}']").trigger("click");
18
+ JS
19
+ end
20
+
21
+ When /^I right click the node with path "([^"]*)"$/ do |path|
22
+ Capybara.current_session.execute_script <<-JS
23
+ var node = Rwiki.treePanel.findNodeByPath('#{path}')
24
+ Rwiki.treePanel.fireEvent('contextmenu', node, { getXY: function() { return [0, 0] } });
25
+ JS
26
+ end
27
+
28
+ Then /^(the node with path "(?:[^"]*)") should be selected$/ do |tree_node_id|
29
+ div_id = Capybara.current_session.evaluate_script <<-JS
30
+ $('div[ext\\\\:tree-node-id="#{tree_node_id}"]').attr('id');
31
+ JS
32
+
33
+ page.has_css? "div##{div_id}.x-tree-selected"
34
+ end
35
+
36
+ Then /^(the node with path "(?:[^"]*)") should not be selected$/ do |tree_node_id|
37
+ div_id = Capybara.current_session.evaluate_script <<-JS
38
+ $('div[ext\\\\:tree-node-id="#{tree_node_id}"]').attr('id');
39
+ JS
40
+
41
+ page.has_no_css? "div##{div_id}.x-tree-selected"
42
+ end
@@ -0,0 +1,21 @@
1
+ When /^I wait for (\d+) second$/ do |n|
2
+ sleep(n.to_i)
3
+ end
4
+
5
+ Given /^I wait for load the tree$/ do
6
+ timeout = 10
7
+ wait_until(timeout) do
8
+ Capybara.current_session.evaluate_script <<-JS
9
+ Rwiki.treeLoaded;
10
+ JS
11
+ end
12
+ end
13
+
14
+ Given /^I wait for load an ajax call complete$/ do
15
+ timeout = 10
16
+ wait_until(timeout) do
17
+ Capybara.current_session.evaluate_script <<-JS
18
+ Rwiki.ajaxCallCompleted;
19
+ JS
20
+ end
21
+ end
@@ -8,6 +8,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '../../test/tmpdir_he
8
8
 
9
9
  Rwiki::App.set(:environment, :test)
10
10
 
11
+ Capybara.default_selector = :css
11
12
  Capybara.register_driver :selenium do |app|
12
13
  Capybara::Driver::Selenium
13
14
  profile = Selenium::WebDriver::Firefox::Profile.new
@@ -24,6 +25,11 @@ World do
24
25
 
25
26
  include TmpdirHelper
26
27
 
28
+ AfterStep do
29
+ Given %Q{I wait for load the tree}
30
+ And %Q{I wait for load an ajax call complete}
31
+ end
32
+
27
33
  Before do
28
34
  create_tmpdir!
29
35
  end
@@ -0,0 +1,47 @@
1
+ Feature: Tab Panel
2
+
3
+ Background:
4
+ Given I open the application
5
+
6
+ @javascript
7
+ Scenario: Close a tab
8
+ When I click the node with path "./home.txt"
9
+ And I click the node with path "./test.txt"
10
+
11
+ Then I should have the following open tabs:
12
+ | home |
13
+ | test |
14
+ And the node with path "./test.txt" should be selected
15
+
16
+ When I close tab for page "./test.txt"
17
+ Then I should have the following open tabs:
18
+ | home |
19
+ And the node with path "./test.txt" should be selected
20
+
21
+ When I close tab for page "./home.txt"
22
+ Then I should have no open tabs
23
+
24
+ @javascript
25
+ Scenario: Switching a tabs
26
+ When I click the node with path "./home.txt"
27
+ And I click the node with path "./test.txt"
28
+ Then I should see "This is a test"
29
+
30
+ When I click tab for page "./home.txt"
31
+ Then I should see "Sample page" within "h1"
32
+ And the node with path "./home.txt" should be selected
33
+ And the node with path "./test.txt" should not be selected
34
+
35
+ When I click tab for page "./test.txt"
36
+ Then I should see "This is a test"
37
+ And the node with path "./test.txt" should be selected
38
+ And the node with path "./home.txt" should not be selected
39
+
40
+ @javascript
41
+ Scenario: Close tab from context menu
42
+
43
+ @javascript
44
+ Scenario: Close other tabs from context menu
45
+
46
+ @javascript
47
+ Scenario: Close all tabs from context menu
@@ -1,25 +1,24 @@
1
1
  Feature: Tree Panel
2
2
 
3
3
  Background:
4
- Given I go to the home page
5
- And I wait for ajax call complete
4
+ Given I open the application
6
5
 
7
6
  @javascript
8
7
  Scenario: Browsing a tree
9
8
  Then I should see "empty_folder"
10
- And I should see "folder"
11
- And I should see "subfolder"
12
- And I should see "home"
13
- And I should see "test"
9
+ And I should see the node titled "folder"
10
+ And I should see the node titled "subfolder"
11
+ And I should see the node titled "home"
12
+ And I should see the node titled "test"
14
13
 
15
- And I should not see "ruby"
16
- And I should not see "test 1"
17
- And I should not see "test 2"
14
+ And I should not see the node titled "ruby"
15
+ And I should not see the node titled "test 1"
16
+ And I should not see the node titled "test 2"
18
17
 
19
- When I double click node "./folder"
20
- Then I should see "test"
21
- And I should see "test 1"
22
- And I should see "test 2"
18
+ When I double click the node with path "./folder"
19
+ Then I should see the node titled "test"
20
+ And I should see the node titled "test 1"
21
+ And I should see the node titled "test 2"
23
22
 
24
- When I double click node "./folder/subfolder"
25
- Then I should see "ruby"
23
+ When I double click the node with path "./folder/subfolder"
24
+ Then I should see the node titled "ruby"