vapid 0.1.0

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 (433) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.gitmodules +6 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +133 -0
  6. data/.travis.yml +5 -0
  7. data/Gemfile +10 -0
  8. data/README.md +37 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/exe/vapid +7 -0
  13. data/lib/vapid.rb +24 -0
  14. data/lib/vapid/assets/javascripts/vapid/admin.coffee +2 -0
  15. data/lib/vapid/assets/stylesheets/vapid/admin.scss +72 -0
  16. data/lib/vapid/builder.rb +70 -0
  17. data/lib/vapid/cli.rb +96 -0
  18. data/lib/vapid/controllers/admin_controller.rb +282 -0
  19. data/lib/vapid/controllers/project_controller.rb +41 -0
  20. data/lib/vapid/db/migrate/20170202182310_create_groups.rb +12 -0
  21. data/lib/vapid/db/migrate/20170202183017_create_records.rb +11 -0
  22. data/lib/vapid/db/migrate/20170202185150_create_users.rb +11 -0
  23. data/lib/vapid/directive.rb +168 -0
  24. data/lib/vapid/directives.rb +30 -0
  25. data/lib/vapid/directives/audio.rb +27 -0
  26. data/lib/vapid/directives/group.rb +71 -0
  27. data/lib/vapid/directives/hide.rb +11 -0
  28. data/lib/vapid/directives/href.rb +11 -0
  29. data/lib/vapid/directives/image.rb +14 -0
  30. data/lib/vapid/directives/richtext.rb +15 -0
  31. data/lib/vapid/directives/show.rb +11 -0
  32. data/lib/vapid/directives/text.rb +24 -0
  33. data/lib/vapid/directives/video.rb +28 -0
  34. data/lib/vapid/generator_template/.gitignore +21 -0
  35. data/lib/vapid/generator_template/Gemfile.tt +13 -0
  36. data/lib/vapid/generator_template/README.md +0 -0
  37. data/lib/vapid/generator_template/assets/favicon.ico +0 -0
  38. data/lib/vapid/generator_template/assets/images/.keep +0 -0
  39. data/lib/vapid/generator_template/assets/javascripts/.keep +0 -0
  40. data/lib/vapid/generator_template/assets/stylesheets/.keep +0 -0
  41. data/lib/vapid/generator_template/assets/stylesheets/application.css +120 -0
  42. data/lib/vapid/generator_template/config.ru +3 -0
  43. data/lib/vapid/generator_template/config/database.yml +12 -0
  44. data/lib/vapid/generator_template/config/settings.yml.tt +11 -0
  45. data/lib/vapid/generator_template/templates/index.html.erb +25 -0
  46. data/lib/vapid/generator_template/templates/layouts/default.html.erb +22 -0
  47. data/lib/vapid/models.rb +18 -0
  48. data/lib/vapid/models/group.rb +36 -0
  49. data/lib/vapid/models/record.rb +30 -0
  50. data/lib/vapid/models/user.rb +16 -0
  51. data/lib/vapid/server.rb +93 -0
  52. data/lib/vapid/settings.rb +13 -0
  53. data/lib/vapid/template.rb +79 -0
  54. data/lib/vapid/template/node.rb +91 -0
  55. data/lib/vapid/template/parser.rb +50 -0
  56. data/lib/vapid/vendor/semantic-ui/.versions +4 -0
  57. data/lib/vapid/vendor/semantic-ui/LICENSE +22 -0
  58. data/lib/vapid/vendor/semantic-ui/README.md +7 -0
  59. data/lib/vapid/vendor/semantic-ui/components/accordion.css +252 -0
  60. data/lib/vapid/vendor/semantic-ui/components/accordion.js +610 -0
  61. data/lib/vapid/vendor/semantic-ui/components/accordion.min.css +9 -0
  62. data/lib/vapid/vendor/semantic-ui/components/accordion.min.js +10 -0
  63. data/lib/vapid/vendor/semantic-ui/components/ad.css +275 -0
  64. data/lib/vapid/vendor/semantic-ui/components/ad.min.css +10 -0
  65. data/lib/vapid/vendor/semantic-ui/components/api.js +1167 -0
  66. data/lib/vapid/vendor/semantic-ui/components/api.min.js +10 -0
  67. data/lib/vapid/vendor/semantic-ui/components/breadcrumb.css +124 -0
  68. data/lib/vapid/vendor/semantic-ui/components/breadcrumb.min.css +9 -0
  69. data/lib/vapid/vendor/semantic-ui/components/button.css +3450 -0
  70. data/lib/vapid/vendor/semantic-ui/components/button.min.css +9 -0
  71. data/lib/vapid/vendor/semantic-ui/components/card.css +964 -0
  72. data/lib/vapid/vendor/semantic-ui/components/card.min.css +9 -0
  73. data/lib/vapid/vendor/semantic-ui/components/checkbox.css +625 -0
  74. data/lib/vapid/vendor/semantic-ui/components/checkbox.js +831 -0
  75. data/lib/vapid/vendor/semantic-ui/components/checkbox.min.css +9 -0
  76. data/lib/vapid/vendor/semantic-ui/components/checkbox.min.js +10 -0
  77. data/lib/vapid/vendor/semantic-ui/components/colorize.js +274 -0
  78. data/lib/vapid/vendor/semantic-ui/components/colorize.min.js +11 -0
  79. data/lib/vapid/vendor/semantic-ui/components/comment.css +270 -0
  80. data/lib/vapid/vendor/semantic-ui/components/comment.min.css +9 -0
  81. data/lib/vapid/vendor/semantic-ui/components/container.css +147 -0
  82. data/lib/vapid/vendor/semantic-ui/components/container.min.css +9 -0
  83. data/lib/vapid/vendor/semantic-ui/components/dimmer.css +200 -0
  84. data/lib/vapid/vendor/semantic-ui/components/dimmer.js +708 -0
  85. data/lib/vapid/vendor/semantic-ui/components/dimmer.min.css +9 -0
  86. data/lib/vapid/vendor/semantic-ui/components/dimmer.min.js +10 -0
  87. data/lib/vapid/vendor/semantic-ui/components/divider.css +260 -0
  88. data/lib/vapid/vendor/semantic-ui/components/divider.min.css +9 -0
  89. data/lib/vapid/vendor/semantic-ui/components/dropdown.css +1442 -0
  90. data/lib/vapid/vendor/semantic-ui/components/dropdown.js +3767 -0
  91. data/lib/vapid/vendor/semantic-ui/components/dropdown.min.css +9 -0
  92. data/lib/vapid/vendor/semantic-ui/components/dropdown.min.js +11 -0
  93. data/lib/vapid/vendor/semantic-ui/components/embed.css +166 -0
  94. data/lib/vapid/vendor/semantic-ui/components/embed.js +696 -0
  95. data/lib/vapid/vendor/semantic-ui/components/embed.min.css +9 -0
  96. data/lib/vapid/vendor/semantic-ui/components/embed.min.js +10 -0
  97. data/lib/vapid/vendor/semantic-ui/components/feed.css +296 -0
  98. data/lib/vapid/vendor/semantic-ui/components/feed.min.css +9 -0
  99. data/lib/vapid/vendor/semantic-ui/components/flag.css +1031 -0
  100. data/lib/vapid/vendor/semantic-ui/components/flag.min.css +9 -0
  101. data/lib/vapid/vendor/semantic-ui/components/form.css +1067 -0
  102. data/lib/vapid/vendor/semantic-ui/components/form.js +1603 -0
  103. data/lib/vapid/vendor/semantic-ui/components/form.min.css +9 -0
  104. data/lib/vapid/vendor/semantic-ui/components/form.min.js +10 -0
  105. data/lib/vapid/vendor/semantic-ui/components/grid.css +2002 -0
  106. data/lib/vapid/vendor/semantic-ui/components/grid.min.css +9 -0
  107. data/lib/vapid/vendor/semantic-ui/components/header.css +721 -0
  108. data/lib/vapid/vendor/semantic-ui/components/header.min.css +9 -0
  109. data/lib/vapid/vendor/semantic-ui/components/icon.css +3292 -0
  110. data/lib/vapid/vendor/semantic-ui/components/icon.min.css +9 -0
  111. data/lib/vapid/vendor/semantic-ui/components/image.css +306 -0
  112. data/lib/vapid/vendor/semantic-ui/components/image.min.css +9 -0
  113. data/lib/vapid/vendor/semantic-ui/components/input.css +510 -0
  114. data/lib/vapid/vendor/semantic-ui/components/input.min.css +9 -0
  115. data/lib/vapid/vendor/semantic-ui/components/item.css +486 -0
  116. data/lib/vapid/vendor/semantic-ui/components/item.min.css +9 -0
  117. data/lib/vapid/vendor/semantic-ui/components/label.css +1307 -0
  118. data/lib/vapid/vendor/semantic-ui/components/label.min.css +9 -0
  119. data/lib/vapid/vendor/semantic-ui/components/list.css +951 -0
  120. data/lib/vapid/vendor/semantic-ui/components/list.min.css +9 -0
  121. data/lib/vapid/vendor/semantic-ui/components/loader.css +347 -0
  122. data/lib/vapid/vendor/semantic-ui/components/loader.min.css +9 -0
  123. data/lib/vapid/vendor/semantic-ui/components/menu.css +2002 -0
  124. data/lib/vapid/vendor/semantic-ui/components/menu.min.css +1 -0
  125. data/lib/vapid/vendor/semantic-ui/components/message.css +477 -0
  126. data/lib/vapid/vendor/semantic-ui/components/message.min.css +9 -0
  127. data/lib/vapid/vendor/semantic-ui/components/modal.css +502 -0
  128. data/lib/vapid/vendor/semantic-ui/components/modal.js +913 -0
  129. data/lib/vapid/vendor/semantic-ui/components/modal.min.css +9 -0
  130. data/lib/vapid/vendor/semantic-ui/components/modal.min.js +10 -0
  131. data/lib/vapid/vendor/semantic-ui/components/nag.css +147 -0
  132. data/lib/vapid/vendor/semantic-ui/components/nag.js +507 -0
  133. data/lib/vapid/vendor/semantic-ui/components/nag.min.css +9 -0
  134. data/lib/vapid/vendor/semantic-ui/components/nag.min.js +10 -0
  135. data/lib/vapid/vendor/semantic-ui/components/popup.css +733 -0
  136. data/lib/vapid/vendor/semantic-ui/components/popup.js +1475 -0
  137. data/lib/vapid/vendor/semantic-ui/components/popup.min.css +9 -0
  138. data/lib/vapid/vendor/semantic-ui/components/popup.min.js +10 -0
  139. data/lib/vapid/vendor/semantic-ui/components/progress.css +516 -0
  140. data/lib/vapid/vendor/semantic-ui/components/progress.js +931 -0
  141. data/lib/vapid/vendor/semantic-ui/components/progress.min.css +9 -0
  142. data/lib/vapid/vendor/semantic-ui/components/progress.min.js +10 -0
  143. data/lib/vapid/vendor/semantic-ui/components/rail.css +152 -0
  144. data/lib/vapid/vendor/semantic-ui/components/rail.min.css +9 -0
  145. data/lib/vapid/vendor/semantic-ui/components/rating.css +263 -0
  146. data/lib/vapid/vendor/semantic-ui/components/rating.js +508 -0
  147. data/lib/vapid/vendor/semantic-ui/components/rating.min.css +9 -0
  148. data/lib/vapid/vendor/semantic-ui/components/rating.min.js +10 -0
  149. data/lib/vapid/vendor/semantic-ui/components/reset.css +424 -0
  150. data/lib/vapid/vendor/semantic-ui/components/reset.min.css +9 -0
  151. data/lib/vapid/vendor/semantic-ui/components/reveal.css +284 -0
  152. data/lib/vapid/vendor/semantic-ui/components/reveal.min.css +9 -0
  153. data/lib/vapid/vendor/semantic-ui/components/search.css +408 -0
  154. data/lib/vapid/vendor/semantic-ui/components/search.js +1442 -0
  155. data/lib/vapid/vendor/semantic-ui/components/search.min.css +9 -0
  156. data/lib/vapid/vendor/semantic-ui/components/search.min.js +10 -0
  157. data/lib/vapid/vendor/semantic-ui/components/segment.css +798 -0
  158. data/lib/vapid/vendor/semantic-ui/components/segment.min.css +9 -0
  159. data/lib/vapid/vendor/semantic-ui/components/shape.css +157 -0
  160. data/lib/vapid/vendor/semantic-ui/components/shape.js +921 -0
  161. data/lib/vapid/vendor/semantic-ui/components/shape.min.css +9 -0
  162. data/lib/vapid/vendor/semantic-ui/components/shape.min.js +10 -0
  163. data/lib/vapid/vendor/semantic-ui/components/sidebar.css +634 -0
  164. data/lib/vapid/vendor/semantic-ui/components/sidebar.js +1036 -0
  165. data/lib/vapid/vendor/semantic-ui/components/sidebar.min.css +9 -0
  166. data/lib/vapid/vendor/semantic-ui/components/sidebar.min.js +10 -0
  167. data/lib/vapid/vendor/semantic-ui/components/site.css +160 -0
  168. data/lib/vapid/vendor/semantic-ui/components/site.js +487 -0
  169. data/lib/vapid/vendor/semantic-ui/components/site.min.css +9 -0
  170. data/lib/vapid/vendor/semantic-ui/components/site.min.js +10 -0
  171. data/lib/vapid/vendor/semantic-ui/components/state.js +708 -0
  172. data/lib/vapid/vendor/semantic-ui/components/state.min.js +10 -0
  173. data/lib/vapid/vendor/semantic-ui/components/statistic.css +569 -0
  174. data/lib/vapid/vendor/semantic-ui/components/statistic.min.css +9 -0
  175. data/lib/vapid/vendor/semantic-ui/components/step.css +623 -0
  176. data/lib/vapid/vendor/semantic-ui/components/step.min.css +9 -0
  177. data/lib/vapid/vendor/semantic-ui/components/sticky.css +78 -0
  178. data/lib/vapid/vendor/semantic-ui/components/sticky.js +942 -0
  179. data/lib/vapid/vendor/semantic-ui/components/sticky.min.css +9 -0
  180. data/lib/vapid/vendor/semantic-ui/components/sticky.min.js +10 -0
  181. data/lib/vapid/vendor/semantic-ui/components/tab.css +91 -0
  182. data/lib/vapid/vendor/semantic-ui/components/tab.js +952 -0
  183. data/lib/vapid/vendor/semantic-ui/components/tab.min.css +9 -0
  184. data/lib/vapid/vendor/semantic-ui/components/tab.min.js +10 -0
  185. data/lib/vapid/vendor/semantic-ui/components/table.css +1108 -0
  186. data/lib/vapid/vendor/semantic-ui/components/table.min.css +9 -0
  187. data/lib/vapid/vendor/semantic-ui/components/transition.css +1964 -0
  188. data/lib/vapid/vendor/semantic-ui/components/transition.js +1095 -0
  189. data/lib/vapid/vendor/semantic-ui/components/transition.min.css +9 -0
  190. data/lib/vapid/vendor/semantic-ui/components/transition.min.js +10 -0
  191. data/lib/vapid/vendor/semantic-ui/components/video.css +125 -0
  192. data/lib/vapid/vendor/semantic-ui/components/video.js +532 -0
  193. data/lib/vapid/vendor/semantic-ui/components/video.min.css +10 -0
  194. data/lib/vapid/vendor/semantic-ui/components/video.min.js +11 -0
  195. data/lib/vapid/vendor/semantic-ui/components/visibility.js +1288 -0
  196. data/lib/vapid/vendor/semantic-ui/components/visibility.min.js +10 -0
  197. data/lib/vapid/vendor/semantic-ui/components/visit.js +517 -0
  198. data/lib/vapid/vendor/semantic-ui/components/visit.min.js +11 -0
  199. data/lib/vapid/vendor/semantic-ui/package.js +34 -0
  200. data/lib/vapid/vendor/semantic-ui/package.json +20 -0
  201. data/lib/vapid/vendor/semantic-ui/semantic.css +36844 -0
  202. data/lib/vapid/vendor/semantic-ui/semantic.js +22617 -0
  203. data/lib/vapid/vendor/semantic-ui/semantic.min.css +364 -0
  204. data/lib/vapid/vendor/semantic-ui/semantic.min.js +19 -0
  205. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.eot +0 -0
  206. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.otf +0 -0
  207. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.svg +2671 -0
  208. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.ttf +0 -0
  209. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff +0 -0
  210. data/lib/vapid/vendor/semantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
  211. data/lib/vapid/vendor/semantic-ui/themes/default/assets/images/flags.png +0 -0
  212. data/lib/vapid/vendor/trix/.blade.yml +45 -0
  213. data/lib/vapid/vendor/trix/.github/ISSUE_TEMPLATE.md +13 -0
  214. data/lib/vapid/vendor/trix/.gitignore +3 -0
  215. data/lib/vapid/vendor/trix/.ruby-version +1 -0
  216. data/lib/vapid/vendor/trix/.travis.yml +6 -0
  217. data/lib/vapid/vendor/trix/CONDUCT.md +79 -0
  218. data/lib/vapid/vendor/trix/Gemfile +17 -0
  219. data/lib/vapid/vendor/trix/Gemfile.lock +152 -0
  220. data/lib/vapid/vendor/trix/LICENSE +20 -0
  221. data/lib/vapid/vendor/trix/README.md +382 -0
  222. data/lib/vapid/vendor/trix/assets/index.html +55 -0
  223. data/lib/vapid/vendor/trix/assets/trix-core.coffee +2 -0
  224. data/lib/vapid/vendor/trix/assets/trix.coffee +3 -0
  225. data/lib/vapid/vendor/trix/assets/trix.scss +5 -0
  226. data/lib/vapid/vendor/trix/assets/trix/banner/index.coffee.erb +3 -0
  227. data/lib/vapid/vendor/trix/assets/trix/banner/index.scss.erb +3 -0
  228. data/lib/vapid/vendor/trix/assets/trix/banner/index.txt.erb +3 -0
  229. data/lib/vapid/vendor/trix/assets/trix/images/README.md +6 -0
  230. data/lib/vapid/vendor/trix/assets/trix/images/attach.svg +5 -0
  231. data/lib/vapid/vendor/trix/assets/trix/images/bold.svg +5 -0
  232. data/lib/vapid/vendor/trix/assets/trix/images/bullets.svg +5 -0
  233. data/lib/vapid/vendor/trix/assets/trix/images/code.svg +5 -0
  234. data/lib/vapid/vendor/trix/assets/trix/images/heading_1.svg +5 -0
  235. data/lib/vapid/vendor/trix/assets/trix/images/italic.svg +5 -0
  236. data/lib/vapid/vendor/trix/assets/trix/images/link.svg +6 -0
  237. data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_decrease.svg +5 -0
  238. data/lib/vapid/vendor/trix/assets/trix/images/nesting_level_increase.svg +5 -0
  239. data/lib/vapid/vendor/trix/assets/trix/images/numbers.svg +5 -0
  240. data/lib/vapid/vendor/trix/assets/trix/images/quote.svg +5 -0
  241. data/lib/vapid/vendor/trix/assets/trix/images/redo.svg +5 -0
  242. data/lib/vapid/vendor/trix/assets/trix/images/remove.svg +4 -0
  243. data/lib/vapid/vendor/trix/assets/trix/images/strike.svg +6 -0
  244. data/lib/vapid/vendor/trix/assets/trix/images/trash.svg +5 -0
  245. data/lib/vapid/vendor/trix/assets/trix/images/undo.svg +5 -0
  246. data/lib/vapid/vendor/trix/assets/trix/stylesheets/attachments.scss +112 -0
  247. data/lib/vapid/vendor/trix/assets/trix/stylesheets/content.scss +88 -0
  248. data/lib/vapid/vendor/trix/assets/trix/stylesheets/editor.scss +8 -0
  249. data/lib/vapid/vendor/trix/assets/trix/stylesheets/icons.scss +14 -0
  250. data/lib/vapid/vendor/trix/assets/trix/stylesheets/media-queries.scss +7 -0
  251. data/lib/vapid/vendor/trix/assets/trix/stylesheets/toolbar.scss +194 -0
  252. data/lib/vapid/vendor/trix/bin/blade +16 -0
  253. data/lib/vapid/vendor/trix/bin/ci +21 -0
  254. data/lib/vapid/vendor/trix/bin/rackup +16 -0
  255. data/lib/vapid/vendor/trix/bin/rake +16 -0
  256. data/lib/vapid/vendor/trix/bin/release +139 -0
  257. data/lib/vapid/vendor/trix/bin/setup +69 -0
  258. data/lib/vapid/vendor/trix/bin/update-status-image +100 -0
  259. data/lib/vapid/vendor/trix/bower.json +34 -0
  260. data/lib/vapid/vendor/trix/config.ru +32 -0
  261. data/lib/vapid/vendor/trix/dist/trix-core.js +11 -0
  262. data/lib/vapid/vendor/trix/dist/trix.css +286 -0
  263. data/lib/vapid/vendor/trix/dist/trix.js +20 -0
  264. data/lib/vapid/vendor/trix/package.json +29 -0
  265. data/lib/vapid/vendor/trix/polyfills/polyfills.coffee +3 -0
  266. data/lib/vapid/vendor/trix/polyfills/set.coffee +24 -0
  267. data/lib/vapid/vendor/trix/polyfills/vendor/CustomElements.js +1029 -0
  268. data/lib/vapid/vendor/trix/polyfills/vendor/README.md +2 -0
  269. data/lib/vapid/vendor/trix/polyfills/vendor/promise.js +228 -0
  270. data/lib/vapid/vendor/trix/src/trix/VERSION +1 -0
  271. data/lib/vapid/vendor/trix/src/trix/config/block_attributes.coffee +37 -0
  272. data/lib/vapid/vendor/trix/src/trix/config/css.coffee +12 -0
  273. data/lib/vapid/vendor/trix/src/trix/config/file_size_formatting.coffee +22 -0
  274. data/lib/vapid/vendor/trix/src/trix/config/index.coffee +9 -0
  275. data/lib/vapid/vendor/trix/src/trix/config/lang.coffee +26 -0
  276. data/lib/vapid/vendor/trix/src/trix/config/selection_elements.coffee +26 -0
  277. data/lib/vapid/vendor/trix/src/trix/config/serialization.coffee +63 -0
  278. data/lib/vapid/vendor/trix/src/trix/config/text_attributes.coffee +25 -0
  279. data/lib/vapid/vendor/trix/src/trix/config/toolbar.coffee +41 -0
  280. data/lib/vapid/vendor/trix/src/trix/config/undo_interval.coffee +7 -0
  281. data/lib/vapid/vendor/trix/src/trix/controllers/attachment_editor_controller.coffee +104 -0
  282. data/lib/vapid/vendor/trix/src/trix/controllers/composition_controller.coffee +117 -0
  283. data/lib/vapid/vendor/trix/src/trix/controllers/controller.coffee +3 -0
  284. data/lib/vapid/vendor/trix/src/trix/controllers/editor_controller.coffee +369 -0
  285. data/lib/vapid/vendor/trix/src/trix/controllers/input/composition_input.coffee +57 -0
  286. data/lib/vapid/vendor/trix/src/trix/controllers/input_controller.coffee +473 -0
  287. data/lib/vapid/vendor/trix/src/trix/controllers/toolbar_controller.coffee +173 -0
  288. data/lib/vapid/vendor/trix/src/trix/core/basic_object.coffee +44 -0
  289. data/lib/vapid/vendor/trix/src/trix/core/collections/element_store.coffee +21 -0
  290. data/lib/vapid/vendor/trix/src/trix/core/collections/hash.coffee +98 -0
  291. data/lib/vapid/vendor/trix/src/trix/core/collections/index.coffee +4 -0
  292. data/lib/vapid/vendor/trix/src/trix/core/collections/object_group.coffee +37 -0
  293. data/lib/vapid/vendor/trix/src/trix/core/collections/object_map.coffee +10 -0
  294. data/lib/vapid/vendor/trix/src/trix/core/helpers/arrays.coffee +34 -0
  295. data/lib/vapid/vendor/trix/src/trix/core/helpers/config.coffee +23 -0
  296. data/lib/vapid/vendor/trix/src/trix/core/helpers/custom_elements.coffee +45 -0
  297. data/lib/vapid/vendor/trix/src/trix/core/helpers/dom.coffee +185 -0
  298. data/lib/vapid/vendor/trix/src/trix/core/helpers/extend.coffee +4 -0
  299. data/lib/vapid/vendor/trix/src/trix/core/helpers/functions.coffee +3 -0
  300. data/lib/vapid/vendor/trix/src/trix/core/helpers/global.coffee +23 -0
  301. data/lib/vapid/vendor/trix/src/trix/core/helpers/index.coffee +10 -0
  302. data/lib/vapid/vendor/trix/src/trix/core/helpers/objects.coffee +11 -0
  303. data/lib/vapid/vendor/trix/src/trix/core/helpers/ranges.coffee +33 -0
  304. data/lib/vapid/vendor/trix/src/trix/core/helpers/selection.coffee +25 -0
  305. data/lib/vapid/vendor/trix/src/trix/core/helpers/strings.coffee +46 -0
  306. data/lib/vapid/vendor/trix/src/trix/core/index.coffee +4 -0
  307. data/lib/vapid/vendor/trix/src/trix/core/object.coffee +33 -0
  308. data/lib/vapid/vendor/trix/src/trix/core/utilities/index.coffee +2 -0
  309. data/lib/vapid/vendor/trix/src/trix/core/utilities/operation.coffee +37 -0
  310. data/lib/vapid/vendor/trix/src/trix/core/utilities/utf16_string.coffee +93 -0
  311. data/lib/vapid/vendor/trix/src/trix/elements/trix_editor_element.coffee +166 -0
  312. data/lib/vapid/vendor/trix/src/trix/elements/trix_toolbar_element.coffee +28 -0
  313. data/lib/vapid/vendor/trix/src/trix/index.coffee.erb +14 -0
  314. data/lib/vapid/vendor/trix/src/trix/inspector/control_element.coffee +60 -0
  315. data/lib/vapid/vendor/trix/src/trix/inspector/debugger.coffee +104 -0
  316. data/lib/vapid/vendor/trix/src/trix/inspector/element.coffee +86 -0
  317. data/lib/vapid/vendor/trix/src/trix/inspector/index.coffee +17 -0
  318. data/lib/vapid/vendor/trix/src/trix/inspector/polyfills/vendor/details-element-polyfill.js +5 -0
  319. data/lib/vapid/vendor/trix/src/trix/inspector/templates/debug.jst.eco +17 -0
  320. data/lib/vapid/vendor/trix/src/trix/inspector/templates/document.jst.eco +33 -0
  321. data/lib/vapid/vendor/trix/src/trix/inspector/templates/performance.jst.eco +10 -0
  322. data/lib/vapid/vendor/trix/src/trix/inspector/templates/render.jst.eco +1 -0
  323. data/lib/vapid/vendor/trix/src/trix/inspector/templates/selection.jst.eco +5 -0
  324. data/lib/vapid/vendor/trix/src/trix/inspector/templates/undo.jst.eco +13 -0
  325. data/lib/vapid/vendor/trix/src/trix/inspector/view.coffee +58 -0
  326. data/lib/vapid/vendor/trix/src/trix/inspector/views/debug_view.coffee +33 -0
  327. data/lib/vapid/vendor/trix/src/trix/inspector/views/document_view.coffee +12 -0
  328. data/lib/vapid/vendor/trix/src/trix/inspector/views/performance_view.coffee +51 -0
  329. data/lib/vapid/vendor/trix/src/trix/inspector/views/render_view.coffee +21 -0
  330. data/lib/vapid/vendor/trix/src/trix/inspector/views/selection_view.coffee +33 -0
  331. data/lib/vapid/vendor/trix/src/trix/inspector/views/undo_view.coffee +12 -0
  332. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/deserializer.coffee +55 -0
  333. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/index.coffee +5 -0
  334. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player.coffee +60 -0
  335. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee +43 -0
  336. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_element.coffee +32 -0
  337. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_view.coffee +133 -0
  338. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recorder.coffee +82 -0
  339. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/recording.coffee +54 -0
  340. data/lib/vapid/vendor/trix/src/trix/inspector/watchdog/serializer.coffee +61 -0
  341. data/lib/vapid/vendor/trix/src/trix/models/attachment.coffee +157 -0
  342. data/lib/vapid/vendor/trix/src/trix/models/attachment_manager.coffee +24 -0
  343. data/lib/vapid/vendor/trix/src/trix/models/attachment_piece.coffee +47 -0
  344. data/lib/vapid/vendor/trix/src/trix/models/block.coffee +230 -0
  345. data/lib/vapid/vendor/trix/src/trix/models/composition.coffee +521 -0
  346. data/lib/vapid/vendor/trix/src/trix/models/document.coffee +538 -0
  347. data/lib/vapid/vendor/trix/src/trix/models/editor.coffee +141 -0
  348. data/lib/vapid/vendor/trix/src/trix/models/html_parser.coffee +335 -0
  349. data/lib/vapid/vendor/trix/src/trix/models/line_break_insertion.coffee +31 -0
  350. data/lib/vapid/vendor/trix/src/trix/models/location_mapper.coffee +156 -0
  351. data/lib/vapid/vendor/trix/src/trix/models/managed_attachment.coffee +28 -0
  352. data/lib/vapid/vendor/trix/src/trix/models/piece.coffee +95 -0
  353. data/lib/vapid/vendor/trix/src/trix/models/point_mapper.coffee +28 -0
  354. data/lib/vapid/vendor/trix/src/trix/models/selection_manager.coffee +129 -0
  355. data/lib/vapid/vendor/trix/src/trix/models/splittable_list.coffee +168 -0
  356. data/lib/vapid/vendor/trix/src/trix/models/string_piece.coffee +49 -0
  357. data/lib/vapid/vendor/trix/src/trix/models/text.coffee +168 -0
  358. data/lib/vapid/vendor/trix/src/trix/models/undo_manager.coffee +40 -0
  359. data/lib/vapid/vendor/trix/src/trix/observers/mutation_observer.coffee +131 -0
  360. data/lib/vapid/vendor/trix/src/trix/observers/selection_change_observer.coffee +56 -0
  361. data/lib/vapid/vendor/trix/src/trix/operations/file_verification_operation.coffee +15 -0
  362. data/lib/vapid/vendor/trix/src/trix/operations/image_preload_operation.coffee +15 -0
  363. data/lib/vapid/vendor/trix/src/trix/views/attachment_view.coffee +99 -0
  364. data/lib/vapid/vendor/trix/src/trix/views/block_view.coffee +37 -0
  365. data/lib/vapid/vendor/trix/src/trix/views/document_view.coffee +68 -0
  366. data/lib/vapid/vendor/trix/src/trix/views/object_group_view.coffee +23 -0
  367. data/lib/vapid/vendor/trix/src/trix/views/object_view.coffee +86 -0
  368. data/lib/vapid/vendor/trix/src/trix/views/piece_view.coffee +97 -0
  369. data/lib/vapid/vendor/trix/src/trix/views/previewable_attachment_view.coffee +49 -0
  370. data/lib/vapid/vendor/trix/src/trix/views/text_view.coffee +30 -0
  371. data/lib/vapid/vendor/trix/test/.gitignore +1 -0
  372. data/lib/vapid/vendor/trix/test/src/system/attachment_test.coffee +70 -0
  373. data/lib/vapid/vendor/trix/test/src/system/basic_input_test.coffee +68 -0
  374. data/lib/vapid/vendor/trix/test/src/system/block_formatting_test.coffee +602 -0
  375. data/lib/vapid/vendor/trix/test/src/system/caching_test.coffee +21 -0
  376. data/lib/vapid/vendor/trix/test/src/system/composition_input_test.coffee +138 -0
  377. data/lib/vapid/vendor/trix/test/src/system/cursor_movement_test.coffee +54 -0
  378. data/lib/vapid/vendor/trix/test/src/system/custom_element_test.coffee +314 -0
  379. data/lib/vapid/vendor/trix/test/src/system/html_loading_test.coffee +62 -0
  380. data/lib/vapid/vendor/trix/test/src/system/html_replacement_test.coffee +101 -0
  381. data/lib/vapid/vendor/trix/test/src/system/installation_process_test.coffee +59 -0
  382. data/lib/vapid/vendor/trix/test/src/system/list_formatting_test.coffee +70 -0
  383. data/lib/vapid/vendor/trix/test/src/system/mutation_input_test.coffee +73 -0
  384. data/lib/vapid/vendor/trix/test/src/system/pasting_test.coffee +215 -0
  385. data/lib/vapid/vendor/trix/test/src/system/text_formatting_test.coffee +151 -0
  386. data/lib/vapid/vendor/trix/test/src/system/undo_test.coffee +48 -0
  387. data/lib/vapid/vendor/trix/test/src/test.coffee +16 -0
  388. data/lib/vapid/vendor/trix/test/src/test_helpers/assertions.coffee +38 -0
  389. data/lib/vapid/vendor/trix/test/src/test_helpers/editor_helpers.coffee +37 -0
  390. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_empty.jst.eco +1 -0
  391. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_html.jst.eco +2 -0
  392. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_in_table.jst.eco +7 -0
  393. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_block_styles.jst.eco +6 -0
  394. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_bold_styles.jst.eco +7 -0
  395. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_image.jst.eco +2 -0
  396. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_styled_content.jst.eco +7 -0
  397. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/editor_with_toolbar_and_input.jst.eco +5 -0
  398. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/fixtures.coffee +536 -0
  399. data/lib/vapid/vendor/trix/test/src/test_helpers/fixtures/logo.png +0 -0
  400. data/lib/vapid/vendor/trix/test/src/test_helpers/index.coffee +18 -0
  401. data/lib/vapid/vendor/trix/test/src/test_helpers/input_helpers.coffee +183 -0
  402. data/lib/vapid/vendor/trix/test/src/test_helpers/selection_helpers.coffee +91 -0
  403. data/lib/vapid/vendor/trix/test/src/test_helpers/test_helpers.coffee +72 -0
  404. data/lib/vapid/vendor/trix/test/src/test_helpers/test_stubs.coffee +31 -0
  405. data/lib/vapid/vendor/trix/test/src/test_helpers/toolbar_helpers.coffee +45 -0
  406. data/lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee +23 -0
  407. data/lib/vapid/vendor/trix/test/src/unit/block_test.coffee +22 -0
  408. data/lib/vapid/vendor/trix/test/src/unit/composition_test.coffee +13 -0
  409. data/lib/vapid/vendor/trix/test/src/unit/document_test.coffee +11 -0
  410. data/lib/vapid/vendor/trix/test/src/unit/document_view_test.coffee +6 -0
  411. data/lib/vapid/vendor/trix/test/src/unit/html_parser_test.coffee +162 -0
  412. data/lib/vapid/vendor/trix/test/src/unit/location_mapper_test.coffee +185 -0
  413. data/lib/vapid/vendor/trix/test/src/unit/mutation_observer_test.coffee +84 -0
  414. data/lib/vapid/vendor/trix/test/src/unit/serialization_test.coffee +7 -0
  415. data/lib/vapid/vendor/trix/test/src/unit/string_change_summary_test.coffee +57 -0
  416. data/lib/vapid/vendor/trix/test/src/unit/text_test.coffee +19 -0
  417. data/lib/vapid/vendor/trix/test/vendor/rangy-core.js +3845 -0
  418. data/lib/vapid/vendor/trix/test/vendor/rangy-textrange.js +1930 -0
  419. data/lib/vapid/version.rb +4 -0
  420. data/lib/vapid/views/admin/install.html.erb +19 -0
  421. data/lib/vapid/views/admin/login.html.erb +11 -0
  422. data/lib/vapid/views/admin/overview/index.html.erb +1 -0
  423. data/lib/vapid/views/admin/records/_form.erb +9 -0
  424. data/lib/vapid/views/admin/records/edit.html.erb +5 -0
  425. data/lib/vapid/views/admin/records/index.html.erb +38 -0
  426. data/lib/vapid/views/admin/records/new.html.erb +3 -0
  427. data/lib/vapid/views/errors/404.html.erb +1 -0
  428. data/lib/vapid/views/errors/500.html.erb +1 -0
  429. data/lib/vapid/views/layouts/admin.html.erb +41 -0
  430. data/lib/vapid/views/layouts/admin_form.html.erb +22 -0
  431. data/lib/vapid/views/layouts/error.html.erb +11 -0
  432. data/vapid.gemspec +48 -0
  433. metadata +811 -0
@@ -0,0 +1,151 @@
1
+ {assert, clickToolbarButton, clickToolbarDialogButton, collapseSelection, expandSelection, insertString, insertText, isToolbarButtonActive, isToolbarButtonDisabled, isToolbarDialogActive, moveCursor, pressKey, test, testGroup, typeCharacters, typeInToolbarDialog, typeToolbarKeyCommand} = Trix.TestHelpers
2
+
3
+ testGroup "Text formatting", template: "editor_empty", ->
4
+ test "applying attributes to text", (done) ->
5
+ typeCharacters "abc", ->
6
+ expandSelection "left", ->
7
+ clickToolbarButton attribute: "bold", ->
8
+ assert.textAttributes([0, 2], {})
9
+ assert.textAttributes([2, 3], bold: true)
10
+ assert.textAttributes([3, 4], blockBreak: true)
11
+ done()
12
+
13
+ test "applying a link to text", (done) ->
14
+ typeCharacters "abc", ->
15
+ moveCursor "left", ->
16
+ expandSelection "left", ->
17
+ clickToolbarButton attribute: "href", ->
18
+ assert.ok isToolbarDialogActive(attribute: "href")
19
+ typeInToolbarDialog "http://example.com", attribute: "href", ->
20
+ assert.textAttributes([0, 1], {})
21
+ assert.textAttributes([1, 2], href: "http://example.com")
22
+ assert.textAttributes([2, 3], {})
23
+ done()
24
+
25
+ test "inserting a link", (expectDocument) ->
26
+ typeCharacters "a", ->
27
+ clickToolbarButton attribute: "href", ->
28
+ assert.ok isToolbarDialogActive(attribute: "href")
29
+ typeInToolbarDialog "http://example.com", attribute: "href", ->
30
+ assert.textAttributes([0, 1], {})
31
+ assert.textAttributes([1, 19], href: "http://example.com")
32
+ expectDocument("ahttp://example.com\n")
33
+
34
+ test "editing a link", (done) ->
35
+ insertString("a")
36
+ text = Trix.Text.textForStringWithAttributes("bc", href: "http://example.com")
37
+ insertText(text)
38
+ insertString("d")
39
+ moveCursor direction: "left", times: 2, ->
40
+ clickToolbarButton attribute: "href", ->
41
+ assert.ok isToolbarDialogActive(attribute: "href")
42
+ assert.locationRange({index: 0, offset: 1}, {index: 0, offset: 3})
43
+ typeInToolbarDialog "http://example.org", attribute: "href", ->
44
+ assert.textAttributes([0, 1], {})
45
+ assert.textAttributes([1, 3], href: "http://example.org")
46
+ assert.textAttributes([3, 4], {})
47
+ done()
48
+
49
+ test "removing a link", (done) ->
50
+ text = Trix.Text.textForStringWithAttributes("ab", href: "http://example.com")
51
+ insertText(text)
52
+ assert.textAttributes([0, 2], href: "http://example.com")
53
+ expandSelection direction: "left", times: 2, ->
54
+ clickToolbarButton attribute: "href", ->
55
+ clickToolbarDialogButton method: "removeAttribute", ->
56
+ assert.textAttributes([0, 2], {})
57
+ done()
58
+
59
+ test "applying a link to an attachment with a host-provided href", (done) ->
60
+ text = fixtures["file attachment"].document.getBlockAtIndex(0).getTextWithoutBlockBreak()
61
+ insertText(text)
62
+ typeCharacters "a", ->
63
+ assert.notOk isToolbarButtonDisabled(attribute: "href")
64
+ expandSelection "left", ->
65
+ assert.notOk isToolbarButtonDisabled(attribute: "href")
66
+ expandSelection "left", ->
67
+ assert.ok isToolbarButtonDisabled(attribute: "href")
68
+ done()
69
+
70
+ test "typing after a link", (done) ->
71
+ typeCharacters "ab", ->
72
+ expandSelection direction: "left", times: 2, ->
73
+ clickToolbarButton attribute: "href", ->
74
+ typeInToolbarDialog "http://example.com", attribute: "href", ->
75
+ collapseSelection "right", ->
76
+ assert.locationRange(index: 0, offset: 2)
77
+ typeCharacters "c", ->
78
+ assert.textAttributes([0, 2], href: "http://example.com")
79
+ assert.textAttributes([2, 3], {})
80
+ moveCursor "left", ->
81
+ assert.notOk isToolbarButtonActive(attribute: "href")
82
+ moveCursor "left", ->
83
+ assert.ok isToolbarButtonActive(attribute: "href")
84
+ done()
85
+
86
+ test "applying formatting and then typing", (done) ->
87
+ typeCharacters "a", ->
88
+ clickToolbarButton attribute: "bold", ->
89
+ typeCharacters "bcd", ->
90
+ clickToolbarButton attribute: "bold", ->
91
+ typeCharacters "e", ->
92
+ assert.textAttributes([0, 1], {})
93
+ assert.textAttributes([1, 4], bold: true)
94
+ assert.textAttributes([4, 5], {})
95
+ done()
96
+
97
+ test "applying formatting and then moving the cursor away", (done) ->
98
+ typeCharacters "abc", ->
99
+ moveCursor "left", ->
100
+ assert.notOk isToolbarButtonActive(attribute: "bold")
101
+ clickToolbarButton attribute: "bold", ->
102
+ assert.ok isToolbarButtonActive(attribute: "bold")
103
+ moveCursor "right", ->
104
+ assert.notOk isToolbarButtonActive(attribute: "bold")
105
+ moveCursor "left", ->
106
+ assert.notOk isToolbarButtonActive(attribute: "bold")
107
+ assert.textAttributes([0, 3], {})
108
+ assert.textAttributes([3, 4], blockBreak: true)
109
+ done()
110
+
111
+ test "applying formatting to an unfocused editor", (done) ->
112
+ input = Trix.makeElement("input", type: "text")
113
+ document.body.appendChild(input)
114
+ input.focus()
115
+
116
+ clickToolbarButton attribute: "bold", ->
117
+ typeCharacters "a", ->
118
+ assert.textAttributes([0, 1], bold: true)
119
+ document.body.removeChild(input)
120
+ done()
121
+
122
+ test "editing formatted text", (done) ->
123
+ clickToolbarButton attribute: "bold", ->
124
+ typeCharacters "ab", ->
125
+ clickToolbarButton attribute: "bold", ->
126
+ typeCharacters "c", ->
127
+ assert.notOk isToolbarButtonActive(attribute: "bold")
128
+ moveCursor "left", ->
129
+ assert.ok isToolbarButtonActive(attribute: "bold")
130
+ moveCursor "left", ->
131
+ assert.ok isToolbarButtonActive(attribute: "bold")
132
+ typeCharacters "Z", ->
133
+ assert.ok isToolbarButtonActive(attribute: "bold")
134
+ assert.textAttributes([0, 3], bold: true)
135
+ assert.textAttributes([3, 4], {})
136
+ assert.textAttributes([4, 5], blockBreak: true)
137
+ moveCursor "right", ->
138
+ assert.ok isToolbarButtonActive(attribute: "bold")
139
+ moveCursor "right", ->
140
+ assert.notOk isToolbarButtonActive(attribute: "bold")
141
+ done()
142
+
143
+ test "key command activates toolbar button", (done) ->
144
+ typeToolbarKeyCommand attribute: "bold", ->
145
+ assert.ok isToolbarButtonActive(attribute: "bold")
146
+ done()
147
+
148
+ test "backspacing newline after text", (expectDocument) ->
149
+ typeCharacters "a\n", ->
150
+ pressKey "backspace", ->
151
+ expectDocument("a\n")
@@ -0,0 +1,48 @@
1
+ {assert, clickToolbarButton, expandSelection, moveCursor, test, testGroup, typeCharacters} = Trix.TestHelpers
2
+
3
+ testGroup "Undo/Redo", template: "editor_empty", ->
4
+ test "typing and undoing", (done) ->
5
+ first = getDocument().copy()
6
+ typeCharacters "abc", ->
7
+ assert.notOk getDocument().isEqualTo(first)
8
+ clickToolbarButton action: "undo", ->
9
+ assert.ok getDocument().isEqualTo(first)
10
+ done()
11
+
12
+ test "typing, formatting, typing, and undoing", (done) ->
13
+ first = getDocument().copy()
14
+ typeCharacters "abc", ->
15
+ second = getDocument().copy()
16
+ clickToolbarButton attribute: "bold", ->
17
+ typeCharacters "def", ->
18
+ third = getDocument().copy()
19
+ clickToolbarButton action: "undo", ->
20
+ assert.ok getDocument().isEqualTo(second)
21
+ clickToolbarButton action: "undo", ->
22
+ assert.ok getDocument().isEqualTo(first)
23
+ clickToolbarButton action: "redo", ->
24
+ assert.ok getDocument().isEqualTo(second)
25
+ clickToolbarButton action: "redo", ->
26
+ assert.ok getDocument().isEqualTo(third)
27
+ done()
28
+
29
+ test "formatting changes are batched by location range", (done) ->
30
+ typeCharacters "abc", ->
31
+ first = getDocument().copy()
32
+ expandSelection "left", ->
33
+ clickToolbarButton attribute: "bold", ->
34
+ clickToolbarButton attribute: "italic", ->
35
+ second = getDocument().copy()
36
+ moveCursor "left", ->
37
+ expandSelection "left", ->
38
+ clickToolbarButton attribute: "italic", ->
39
+ third = getDocument().copy()
40
+ clickToolbarButton action: "undo", ->
41
+ assert.ok getDocument().isEqualTo(second)
42
+ clickToolbarButton action: "undo", ->
43
+ assert.ok getDocument().isEqualTo(first)
44
+ clickToolbarButton action: "redo", ->
45
+ assert.ok getDocument().isEqualTo(second)
46
+ clickToolbarButton action: "redo", ->
47
+ assert.ok getDocument().isEqualTo(third)
48
+ done()
@@ -0,0 +1,16 @@
1
+ #= require trix/core/helpers/global
2
+ #= require ./test_helpers/index
3
+ #= require_tree ./system
4
+ #= require_tree ./unit
5
+
6
+ Trix.config.undoInterval = 0
7
+
8
+ document.head.insertAdjacentHTML "beforeend", """
9
+ <style type="text/css">
10
+ #trix-container { height: 150px; }
11
+ trix-toolbar { margin-bottom: 10px; }
12
+ trix-toolbar button { border: 1px solid #ccc; background: #fff; }
13
+ trix-toolbar button.active { background: #d3e6fd; }
14
+ trix-toolbar button:disabled { color: #ccc; }
15
+ </style>
16
+ """
@@ -0,0 +1,38 @@
1
+ {normalizeRange, rangesAreEqual} = Trix
2
+
3
+ helpers = Trix.TestHelpers
4
+ helpers.assert = QUnit.assert
5
+
6
+ helpers.assert.locationRange = (start, end) ->
7
+ expectedLocationRange = normalizeRange([start, end])
8
+ actualLocationRange = getEditorController().getLocationRange()
9
+ @deepEqual(actualLocationRange, expectedLocationRange)
10
+
11
+ helpers.assert.textAttributes = (range, attributes) ->
12
+ document = getDocument().getDocumentAtRange(range)
13
+ blocks = document.getBlocks()
14
+ throw "range #{JSON.stringify(range)} spans more than one block" unless blocks.length is 1
15
+
16
+ locationRange = getDocument().locationRangeFromRange(range)
17
+ textIndex = locationRange[0].index
18
+ textRange = [locationRange[0].offset, locationRange[1].offset]
19
+ text = getDocument().getTextAtIndex(textIndex).getTextAtRange(textRange)
20
+ pieces = text.getPieces()
21
+ throw "range #{JSON.stringify(range)} must only span one piece" unless pieces.length is 1
22
+
23
+ piece = pieces[0]
24
+ @deepEqual piece.getAttributes(), attributes
25
+
26
+ helpers.assert.blockAttributes = (range, attributes) ->
27
+ document = getDocument().getDocumentAtRange(range)
28
+ blocks = document.getBlocks()
29
+ throw "range #{JSON.stringify(range)} spans more than one block" unless blocks.length is 1
30
+
31
+ block = blocks[0]
32
+ @deepEqual block.getAttributes(), attributes
33
+
34
+ helpers.assert.documentHTMLEqual = (trixDocument, html) ->
35
+ @equal helpers.getHTML(trixDocument), html
36
+
37
+ helpers.getHTML = (trixDocument) ->
38
+ Trix.DocumentView.render(trixDocument).innerHTML
@@ -0,0 +1,37 @@
1
+ helpers = Trix.TestHelpers
2
+
3
+ helpers.extend
4
+ insertString: (string) ->
5
+ getComposition().insertString(string)
6
+ render()
7
+
8
+ insertText: (text) ->
9
+ getComposition().insertText(text)
10
+ render()
11
+
12
+ insertDocument: (document) ->
13
+ getComposition().insertDocument(document)
14
+ render()
15
+
16
+ insertFile: (file) ->
17
+ getComposition().insertFile(file)
18
+ render()
19
+
20
+ insertImageAttachment: (attributes) ->
21
+ attributes ?=
22
+ url: TEST_IMAGE_URL
23
+ width: 10
24
+ height: 10
25
+ filename: "image.gif"
26
+ contentType: "image/gif"
27
+
28
+ attachment = new Trix.Attachment attributes
29
+ text = Trix.Text.textForAttachmentWithAttributes(attachment)
30
+ helpers.insertText(text)
31
+
32
+ replaceDocument: (document) ->
33
+ getComposition().setDocument(document)
34
+ render()
35
+
36
+ render = ->
37
+ getEditorController().render()
@@ -0,0 +1 @@
1
+ <trix-editor autofocus placeholder="Say hello..."></trix-editor>
@@ -0,0 +1,2 @@
1
+ <trix-editor input="my_input" autofocus placeholder="Say hello..."></trix-editor>
2
+ <input id="my_input" type="hidden" value="&lt;div&gt;Hello world&lt;/div&gt;">
@@ -0,0 +1,7 @@
1
+ <table>
2
+ <tr>
3
+ <td>
4
+ <trix-editor></trix-editor>
5
+ </td>
6
+ </tr>
7
+ </table>
@@ -0,0 +1,6 @@
1
+ <style type="text/css">
2
+ blockquote { font-style: italic; }
3
+ li { font-weight: bold; }
4
+ </style>
5
+
6
+ <trix-editor class="trix-content"></trix-editor>
@@ -0,0 +1,7 @@
1
+ <style type="text/css">
2
+ strong { font-weight: 500; }
3
+ span { font-weight: 600; }
4
+ article { font-weight: bold; }
5
+ </style>
6
+
7
+ <trix-editor class="trix-content"></trix-editor>
@@ -0,0 +1,2 @@
1
+ <trix-editor input="my_input" autofocus placeholder="Say hello..."></trix-editor>
2
+ <input id="my_input" type="hidden" value="ab&lt;img src=&quot;<%= TEST_IMAGE_URL %>&quot; width=&quot;10&quot; height=&quot;10&quot;&gt;">
@@ -0,0 +1,7 @@
1
+ <style type="text/css">
2
+ .trix-content figure.attachment {
3
+ display: inline-block;
4
+ }
5
+ </style>
6
+
7
+ <trix-editor class="trix-content"></trix-editor>
@@ -0,0 +1,5 @@
1
+ <ul id="my_editor">
2
+ <li><trix-toolbar id="my_toolbar"></trix-toolbar></li>
3
+ <li><trix-editor toolbar="my_toolbar" input="my_input" autofocus placeholder="Say hello..."></trix-editor></li>
4
+ <li><input id="my_input" type="hidden" value="&lt;div&gt;Hello world&lt;/div&gt;"></li>
5
+ </ul>
@@ -0,0 +1,536 @@
1
+ {classNames} = Trix.config.css
2
+
3
+ @TEST_IMAGE_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="
4
+
5
+ createDocument = (parts...) ->
6
+ blocks = for part in parts
7
+ [string, textAttributes, blockAttributes] = part
8
+ text = Trix.Text.textForStringWithAttributes(string, textAttributes)
9
+ new Trix.Block text, blockAttributes
10
+ new Trix.Document blocks
11
+
12
+ blockComment = "<!--block-->"
13
+
14
+ cursorTarget = Trix.makeElement(
15
+ tagName: "span"
16
+ textContent: Trix.ZERO_WIDTH_SPACE
17
+ data: trixSelection: true, trixCursorTarget: true, trixSerialize: false
18
+ ).outerHTML
19
+
20
+ removeWhitespace = (string) ->
21
+ string.replace(/\s/g, "")
22
+
23
+ @fixtures =
24
+ "bold text":
25
+ document: createDocument(["abc", bold: true])
26
+ html: "<div>#{blockComment}<strong>abc</strong></div>"
27
+ serializedHTML: "<div><strong>abc</strong></div>"
28
+
29
+ "bold, italic text":
30
+ document: createDocument(["abc", bold: true, italic: true])
31
+ html: "<div>#{blockComment}<strong><em>abc</em></strong></div>"
32
+
33
+ "text with newline":
34
+ document: createDocument(["ab\nc"])
35
+ html: "<div>#{blockComment}ab<br>c</div>"
36
+
37
+ "text with link":
38
+ document: createDocument(["abc", href: "http://example.com"])
39
+ html: """<div>#{blockComment}<a href="http://example.com">abc</a></div>"""
40
+
41
+ "text with link and formatting":
42
+ document: createDocument(["abc", italic: true, href: "http://example.com"])
43
+ html: """<div>#{blockComment}<a href="http://example.com"><em>abc</em></a></div>"""
44
+
45
+ "partially formatted link":
46
+ document: new Trix.Document [
47
+ new Trix.Block new Trix.Text [
48
+ new Trix.StringPiece "ab", href: "http://example.com"
49
+ new Trix.StringPiece "c", href: "http://example.com", italic: true
50
+ ]
51
+ ]
52
+ html: """<div>#{blockComment}<a href="http://example.com">ab<em>c</em></a></div>"""
53
+
54
+ "spaces 1":
55
+ document: createDocument([" a"])
56
+ html: """<div>#{blockComment}&nbsp;a</div>"""
57
+
58
+ "spaces 2":
59
+ document: createDocument([" a"])
60
+ html: """<div>#{blockComment}&nbsp; a</div>"""
61
+
62
+ "spaces 3":
63
+ document: createDocument([" a"])
64
+ html: """<div>#{blockComment}&nbsp; &nbsp;a</div>"""
65
+
66
+ "spaces 4":
67
+ document: createDocument([" a "])
68
+ html: """<div>#{blockComment}&nbsp;a&nbsp;</div>"""
69
+
70
+ "spaces 5":
71
+ document: createDocument(["a b"])
72
+ html: """<div>#{blockComment}a&nbsp; b</div>"""
73
+
74
+ "spaces 6":
75
+ document: createDocument(["a b"])
76
+ html: """<div>#{blockComment}a &nbsp; b</div>"""
77
+
78
+ "spaces 7":
79
+ document: createDocument(["a b"])
80
+ html: """<div>#{blockComment}a&nbsp; &nbsp; b</div>"""
81
+
82
+ "spaces 8":
83
+ document: createDocument(["a b "])
84
+ html: """<div>#{blockComment}a b&nbsp;</div>"""
85
+
86
+ "spaces 9":
87
+ document: createDocument(["a b c"])
88
+ html: """<div>#{blockComment}a b c</div>"""
89
+
90
+ "spaces 10":
91
+ document: createDocument(["a "])
92
+ html: """<div>#{blockComment}a&nbsp;</div>"""
93
+
94
+ "spaces 11":
95
+ document: createDocument(["a "])
96
+ html: """<div>#{blockComment}a &nbsp;</div>"""
97
+
98
+ "spaces and formatting":
99
+ document: new Trix.Document [
100
+ new Trix.Block new Trix.Text [
101
+ new Trix.StringPiece " a "
102
+ new Trix.StringPiece "b", href: "http://b.com"
103
+ new Trix.StringPiece " "
104
+ new Trix.StringPiece "c", bold: true
105
+ new Trix.StringPiece " d"
106
+ new Trix.StringPiece " e ", italic: true
107
+ new Trix.StringPiece " f "
108
+ ]
109
+ ]
110
+ html: """<div>#{blockComment}&nbsp;a <a href="http://b.com">b</a> <strong>c</strong> d<em> e </em>&nbsp;f &nbsp;</div>"""
111
+
112
+ "quote formatted block":
113
+ document: createDocument(["abc", {}, ["quote"]])
114
+ html: "<blockquote>#{blockComment}abc</blockquote>"
115
+
116
+ "code formatted block":
117
+ document: createDocument(["123", {}, ["code"]])
118
+ html: "<pre>#{blockComment}123</pre>"
119
+
120
+ "code with newline":
121
+ document: createDocument(["12\n3", {}, ["code"]])
122
+ html: "<pre>#{blockComment}12\n3</pre>"
123
+
124
+ "multiple blocks with block comments in their text":
125
+ document: createDocument(["a#{blockComment}b", {}, ["quote"]], ["#{blockComment}c", {}, ["code"]])
126
+ html: "<blockquote>#{blockComment}a&lt;!--block--&gt;b</blockquote><pre>#{blockComment}&lt;!--block--&gt;c</pre>"
127
+ serializedHTML: "<blockquote>a&lt;!--block--&gt;b</blockquote><pre>&lt;!--block--&gt;c</pre>"
128
+
129
+ "unordered list with one item":
130
+ document: createDocument(["a", {}, ["bulletList", "bullet"]])
131
+ html: "<ul><li>#{blockComment}a</li></ul>"
132
+
133
+ "unordered list with bold text":
134
+ document: createDocument(["a", { bold: true }, ["bulletList", "bullet"]])
135
+ html: "<ul><li>#{blockComment}<strong>a</strong></li></ul>"
136
+
137
+ "unordered list with partially formatted text":
138
+ document: new Trix.Document [
139
+ new Trix.Block(
140
+ new Trix.Text([
141
+ new Trix.StringPiece("a")
142
+ new Trix.StringPiece("b", italic: true)
143
+ ]),
144
+ ["bulletList", "bullet"]
145
+ )
146
+ ]
147
+ html: "<ul><li>#{blockComment}a<em>b</em></li></ul>"
148
+
149
+ "unordered list with two items":
150
+ document: createDocument(["a", {}, ["bulletList", "bullet"]], ["b", {}, ["bulletList", "bullet"]])
151
+ html: "<ul><li>#{blockComment}a</li><li>#{blockComment}b</li></ul>"
152
+
153
+ "unordered list surrounded by unformatted blocks":
154
+ document: createDocument(["a"], ["b", {}, ["bulletList", "bullet"]], ["c"])
155
+ html: "<div>#{blockComment}a</div><ul><li>#{blockComment}b</li></ul><div>#{blockComment}c</div>"
156
+
157
+ "ordered list":
158
+ document: createDocument(["a", {}, ["numberList", "number"]])
159
+ html: "<ol><li>#{blockComment}a</li></ol>"
160
+
161
+ "ordered list and an unordered list":
162
+ document: createDocument(["a", {}, ["bulletList", "bullet"]], ["b", {}, ["numberList", "number"]])
163
+ html: "<ul><li>#{blockComment}a</li></ul><ol><li>#{blockComment}b</li></ol>"
164
+
165
+ "empty block with attributes":
166
+ document: createDocument(["", {}, ["quote"]])
167
+ html: "<blockquote>#{blockComment}<br></blockquote>"
168
+
169
+ "image attachment": do ->
170
+ attrs = url: TEST_IMAGE_URL, filename: "example.png", filesize: 98203, contentType: "image/png", width: 1, height: 1
171
+ attachment = new Trix.Attachment attrs
172
+ text = Trix.Text.textForAttachmentWithAttributes(attachment)
173
+
174
+ image = Trix.makeElement("img", src: attrs.url, "data-trix-mutable": true, width: 1, height: 1)
175
+ image.dataset.trixStoreKey = ["imageElement", attachment.id, image.src, image.width, image.height].join("/")
176
+
177
+ caption = Trix.makeElement(tagName: "figcaption", className: classNames.attachment.caption)
178
+ caption.innerHTML = """#{attrs.filename} <span class="#{classNames.attachment.size}">95.9 KB</span>"""
179
+
180
+ figure = Trix.makeElement
181
+ tagName: "figure"
182
+ className: "attachment attachment-preview png"
183
+
184
+ data =
185
+ trixAttachment: JSON.stringify(attachment)
186
+ trixContentType: "image/png"
187
+ trixId: attachment.id
188
+
189
+ figure.dataset[key] = value for key, value of data
190
+ figure.setAttribute("contenteditable", false)
191
+ figure.appendChild(image)
192
+ figure.appendChild(caption)
193
+
194
+ serializedFigure = figure.cloneNode(true)
195
+ for attribute in ["data-trix-id", "data-trix-mutable", "data-trix-store-key", "contenteditable"]
196
+ serializedFigure.removeAttribute(attribute)
197
+ for element in serializedFigure.querySelectorAll("[#{attribute}]")
198
+ element.removeAttribute(attribute)
199
+
200
+ html: "<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"
201
+ serializedHTML: "<div>#{serializedFigure.outerHTML}</div>"
202
+ document: new Trix.Document [new Trix.Block text]
203
+
204
+ "text with newlines and image attachment": do ->
205
+ stringText = Trix.Text.textForStringWithAttributes("a\nb")
206
+
207
+ attrs = url: TEST_IMAGE_URL, filename: "example.png", filesize: 98203, contentType: "image/png", width: 1, height: 1
208
+ attachment = new Trix.Attachment attrs
209
+ attachmentText = Trix.Text.textForAttachmentWithAttributes(attachment)
210
+
211
+ image = Trix.makeElement("img", src: attrs.url, "data-trix-mutable": true, width: 1, height: 1)
212
+ image.dataset.trixStoreKey = ["imageElement", attachment.id, image.src, image.width, image.height].join("/")
213
+
214
+ caption = Trix.makeElement(tagName: "figcaption", className: classNames.attachment.caption)
215
+ caption.innerHTML = """#{attrs.filename} <span class="#{classNames.attachment.size}">95.9 KB</span>"""
216
+
217
+ figure = Trix.makeElement
218
+ tagName: "figure"
219
+ className: "attachment attachment-preview png"
220
+
221
+ data =
222
+ trixAttachment: JSON.stringify(attachment)
223
+ trixContentType: "image/png"
224
+ trixId: attachment.id
225
+
226
+ figure.dataset[key] = value for key, value of data
227
+ figure.setAttribute("contenteditable", false)
228
+ figure.appendChild(image)
229
+ figure.appendChild(caption)
230
+
231
+ serializedFigure = figure.cloneNode(true)
232
+ for attribute in ["data-trix-id", "data-trix-mutable", "data-trix-store-key", "contenteditable"]
233
+ serializedFigure.removeAttribute(attribute)
234
+ for element in serializedFigure.querySelectorAll("[#{attribute}]")
235
+ element.removeAttribute(attribute)
236
+
237
+ text = stringText.appendText(attachmentText)
238
+
239
+ html: "<div>#{blockComment}a<br>b#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"
240
+ serializedHTML: "<div>a<br>b#{serializedFigure.outerHTML}</div>"
241
+ document: new Trix.Document [new Trix.Block text]
242
+
243
+ "image attachment with edited caption": do ->
244
+ attrs = url: TEST_IMAGE_URL, filename: "example.png", filesize: 123, contentType: "image/png", width: 1, height: 1
245
+ attachment = new Trix.Attachment attrs
246
+ textAttrs = caption: "Example"
247
+ text = Trix.Text.textForAttachmentWithAttributes(attachment, textAttrs)
248
+
249
+ image = Trix.makeElement("img", src: attrs.url, "data-trix-mutable": true, width: 1, height: 1)
250
+ image.dataset.trixStoreKey = ["imageElement", attachment.id, image.src, image.width, image.height].join("/")
251
+
252
+ caption = Trix.makeElement(tagName: "figcaption", className: "#{classNames.attachment.caption} #{classNames.attachment.captionEdited}", textContent: "Example")
253
+
254
+ figure = Trix.makeElement
255
+ tagName: "figure"
256
+ className: "attachment attachment-preview png"
257
+
258
+ data =
259
+ trixAttachment: JSON.stringify(attachment)
260
+ trixContentType: "image/png"
261
+ trixId: attachment.id
262
+ trixAttributes: JSON.stringify(textAttrs)
263
+
264
+ figure.dataset[key] = value for key, value of data
265
+ figure.setAttribute("contenteditable", false)
266
+ figure.appendChild(image)
267
+ figure.appendChild(caption)
268
+
269
+ html: "<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"
270
+ document: new Trix.Document [new Trix.Block text]
271
+
272
+ "file attachment": do ->
273
+ attrs = href: "http://example.com/example.pdf", filename: "example.pdf", filesize: 34038769, contentType: "application/pdf"
274
+ attachment = new Trix.Attachment attrs
275
+ text = Trix.Text.textForAttachmentWithAttributes(attachment)
276
+
277
+ figure = Trix.makeElement
278
+ tagName: "figure"
279
+ className: "attachment attachment-file pdf"
280
+
281
+ data =
282
+ trixAttachment: JSON.stringify(attachment)
283
+ trixContentType: "application/pdf"
284
+ trixId: attachment.id
285
+
286
+ link = Trix.makeElement("a", href: attrs.href)
287
+ link.dataset[key] = value for key, value of data
288
+ link.setAttribute("contenteditable", false)
289
+ link.appendChild(figure)
290
+
291
+ caption = """<figcaption class="#{classNames.attachment.caption}">#{attrs.filename} <span class="#{classNames.attachment.size}">32.46 MB</span></figcaption>"""
292
+ figure.innerHTML = caption
293
+
294
+ html: """<div>#{blockComment}#{cursorTarget}#{link.outerHTML}#{cursorTarget}</div>"""
295
+ document: new Trix.Document [new Trix.Block text]
296
+
297
+ "pending file attachment": do ->
298
+ attrs = filename: "example.pdf", filesize: 34038769, contentType: "application/pdf"
299
+ attachment = new Trix.Attachment attrs
300
+ attachment.file = {}
301
+ text = Trix.Text.textForAttachmentWithAttributes(attachment)
302
+
303
+ figure = Trix.makeElement
304
+ tagName: "figure"
305
+ className: "attachment attachment-file pdf"
306
+
307
+ data =
308
+ trixAttachment: JSON.stringify(attachment)
309
+ trixContentType: "application/pdf"
310
+ trixId: attachment.id
311
+ trixSerialize: false
312
+
313
+ figure.dataset[key] = value for key, value of data
314
+ figure.setAttribute("contenteditable", false)
315
+
316
+ progress = Trix.makeElement
317
+ tagName: "progress"
318
+ attributes:
319
+ class: "progress"
320
+ value: 0
321
+ max: 100
322
+ data:
323
+ trixMutable: true
324
+ trixStoreKey: ["progressElement", attachment.id].join("/")
325
+
326
+ caption = """<figcaption class="#{classNames.attachment.caption}">#{attrs.filename} <span class="#{classNames.attachment.size}">32.46 MB</span></figcaption>"""
327
+ figure.innerHTML = caption + progress.outerHTML
328
+
329
+ html: """<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"""
330
+ document: new Trix.Document [new Trix.Block text]
331
+
332
+ "content attachment": do ->
333
+ content = """<blockquote class="twitter-tweet" data-cards="hidden"><p>ruby-build 20150413 is out, with definitions for 2.2.2, 2.1.6, and 2.0.0-p645 to address recent security issues: <a href="https://t.co/YEwV6NtRD8">https://t.co/YEwV6NtRD8</a></p>&mdash; Sam Stephenson (@sstephenson) <a href="https://twitter.com/sstephenson/status/587715996783218688">April 13, 2015</a></blockquote>"""
334
+ href = "https://twitter.com/sstephenson/status/587715996783218688"
335
+ contentType = "embed/twitter"
336
+
337
+ attachment = new Trix.Attachment {content, contentType, href}
338
+ text = Trix.Text.textForAttachmentWithAttributes(attachment)
339
+
340
+ figure = Trix.makeElement
341
+ tagName: "figure"
342
+ className: "attachment attachment-content"
343
+
344
+ figure.innerHTML = content
345
+
346
+ caption = Trix.makeElement(tagName: "figcaption", className: classNames.attachment.caption)
347
+ figure.appendChild(caption)
348
+
349
+ data =
350
+ trixAttachment: JSON.stringify(attachment)
351
+ trixContentType: contentType
352
+ trixId: attachment.id
353
+
354
+ figure.dataset[key] = value for key, value of data
355
+ figure.setAttribute("contenteditable", false)
356
+
357
+ html: """<div>#{blockComment}#{cursorTarget}#{figure.outerHTML}#{cursorTarget}</div>"""
358
+ document: new Trix.Document [new Trix.Block text]
359
+
360
+ "nested quote and code formatted block":
361
+ document: createDocument(["ab3", {}, ["quote", "code"]])
362
+ html: "<blockquote><pre>#{blockComment}ab3</pre></blockquote>"
363
+
364
+ "nested code and quote formatted block":
365
+ document: createDocument(["ab3", {}, ["code", "quote"]])
366
+ html: "<pre><blockquote>#{blockComment}ab3</blockquote></pre>"
367
+
368
+ "nested code blocks in quote":
369
+ document: createDocument(
370
+ ["a\n", {}, ["quote"]],
371
+ ["b", {}, ["quote", "code"]],
372
+ ["\nc\n", {}, ["quote"]],
373
+ ["d", {}, ["quote", "code"]]
374
+ )
375
+ html: removeWhitespace """
376
+ <blockquote>
377
+ #{blockComment}
378
+ a
379
+ <br>
380
+ <br>
381
+ <pre>
382
+ #{blockComment}
383
+ b
384
+ </pre>
385
+ #{blockComment}
386
+ <br>
387
+ c
388
+ <br>
389
+ <br>
390
+ <pre>
391
+ #{blockComment}
392
+ d
393
+ </pre>
394
+ </blockquote>
395
+ """
396
+ serializedHTML: removeWhitespace """
397
+ <blockquote>
398
+ a
399
+ <br>
400
+ <br>
401
+ <pre>
402
+ b
403
+ </pre>
404
+ <br>
405
+ c
406
+ <br>
407
+ <br>
408
+ <pre>
409
+ d
410
+ </pre>
411
+ </blockquote>
412
+ """
413
+
414
+ "nested code, quote, and list in quote":
415
+ document: createDocument(
416
+ ["a\n", {}, ["quote"]],
417
+ ["b", {}, ["quote", "code"]],
418
+ ["\nc\n", {}, ["quote"]],
419
+ ["d", {}, ["quote", "quote"]],
420
+ ["\ne\n", {}, ["quote"]],
421
+ ["f", {}, ["quote", "bulletList", "bullet"]]
422
+ )
423
+ html: removeWhitespace """
424
+ <blockquote>
425
+ #{blockComment}
426
+ a
427
+ <br>
428
+ <br>
429
+ <pre>
430
+ #{blockComment}
431
+ b
432
+ </pre>
433
+ #{blockComment}
434
+ <br>
435
+ c
436
+ <br>
437
+ <br>
438
+ <blockquote>
439
+ #{blockComment}
440
+ d
441
+ </blockquote>
442
+ #{blockComment}
443
+ <br>
444
+ e
445
+ <br>
446
+ <br>
447
+ <ul>
448
+ <li>
449
+ #{blockComment}
450
+ f
451
+ </li>
452
+ </ul>
453
+ </blockquote>
454
+ """
455
+ serializedHTML: removeWhitespace """
456
+ <blockquote>
457
+ a
458
+ <br>
459
+ <br>
460
+ <pre>
461
+ b
462
+ </pre>
463
+ <br>
464
+ c
465
+ <br>
466
+ <br>
467
+ <blockquote>
468
+ d
469
+ </blockquote>
470
+ <br>
471
+ e
472
+ <br>
473
+ <br>
474
+ <ul>
475
+ <li>
476
+ f
477
+ </li>
478
+ </ul>
479
+ </blockquote>
480
+ """
481
+
482
+ "nested quote and list":
483
+ document: createDocument(["ab3", {}, ["quote", "bulletList", "bullet"]])
484
+ html: "<blockquote><ul><li>#{blockComment}ab3</li></ul></blockquote>"
485
+
486
+ "nested list and quote":
487
+ document: createDocument(["ab3", {}, ["bulletList", "bullet", "quote"]])
488
+ html: "<ul><li><blockquote>#{blockComment}ab3</blockquote></li></ul>"
489
+
490
+ "nested lists and quotes":
491
+ document: createDocument(["a", {}, ["bulletList", "bullet", "quote"]], ["b", {}, ["bulletList", "bullet", "quote"]])
492
+ html: "<ul><li><blockquote>#{blockComment}a</blockquote></li><li><blockquote>#{blockComment}b</blockquote></li></ul>"
493
+
494
+ "nested quote and list with two items":
495
+ document: createDocument(["a", {}, ["quote", "bulletList", "bullet"]], ["b", {}, ["quote", "bulletList", "bullet"]])
496
+ html: "<blockquote><ul><li>#{blockComment}a</li><li>#{blockComment}b</li></ul></blockquote>"
497
+
498
+ "nested unordered lists":
499
+ document: createDocument(["a", {}, ["bulletList", "bullet"]], ["b", {}, ["bulletList", "bullet", "bulletList", "bullet"]], ["c", {}, ["bulletList", "bullet", "bulletList", "bullet"]])
500
+ html: "<ul><li>#{blockComment}a<ul><li>#{blockComment}b</li><li>#{blockComment}c</li></ul></li></ul>"
501
+
502
+ "nested lists":
503
+ document: createDocument(["a", {}, ["numberList", "number"]], ["b", {}, ["numberList", "number", "bulletList", "bullet"]], ["c", {}, ["numberList", "number", "bulletList", "bullet"]])
504
+ html: "<ol><li>#{blockComment}a<ul><li>#{blockComment}b</li><li>#{blockComment}c</li></ul></li></ol>"
505
+
506
+ "blocks beginning with newlines":
507
+ document: createDocument(["\na", {}, ["quote"]], ["\nb", {}, []], ["\nc", {}, ["quote"]])
508
+ html: "<blockquote>#{blockComment}<br>a</blockquote><div>#{blockComment}<br>b</div><blockquote>#{blockComment}<br>c</blockquote>"
509
+
510
+ "blocks beginning with formatted text":
511
+ document: createDocument(["a", { bold: true }, ["quote"]], ["b", { italic: true }, []], ["c", { bold: true }, ["quote"]])
512
+ html: "<blockquote>#{blockComment}<strong>a</strong></blockquote><div>#{blockComment}<em>b</em></div><blockquote>#{blockComment}<strong>c</strong></blockquote>"
513
+
514
+ "text with newlines before block":
515
+ document: createDocument(["a\nb"], ["c", {}, ["quote"]])
516
+ html: "<div>#{blockComment}a<br>b</div><blockquote>#{blockComment}c</blockquote>"
517
+
518
+ "empty heading block":
519
+ document: createDocument(["", {}, ["heading1"]])
520
+ html: "<h1>#{blockComment}<br></h1>"
521
+
522
+ "two adjacent headings":
523
+ document: createDocument( ["a", {}, ["heading1"]], ["b", {}, ["heading1"]])
524
+ html: "<h1>#{blockComment}a</h1><h1>#{blockComment}b</h1>"
525
+
526
+ "heading in ordered list":
527
+ document: createDocument(["a", {}, ["numberList", "number", "heading1"]])
528
+ html: "<ol><li><h1>#{blockComment}a</h1></li></ol>"
529
+
530
+ "headings with formatted text":
531
+ document: createDocument(["a", { bold: true }, ["heading1"]], ["b", { italic: true, bold: true }, ["heading1"]])
532
+ html: "<h1>#{blockComment}<strong>a</strong></h1><h1>#{blockComment}<strong><em>b</em></strong></h1>"
533
+
534
+ @eachFixture = (callback) ->
535
+ for name, details of @fixtures
536
+ callback(name, details)