scarpe 0.2.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -1
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +52 -6
  5. data/Gemfile +2 -1
  6. data/Gemfile.lock +20 -6
  7. data/LICENSE.txt +7 -1
  8. data/README.md +100 -21
  9. data/Rakefile +68 -1
  10. data/examples/Edit_box_Styles.rb +8 -0
  11. data/examples/Kerning.rb +7 -0
  12. data/examples/animate.rb +20 -0
  13. data/examples/arrow.rb +10 -0
  14. data/examples/border.rb +11 -0
  15. data/examples/btn_tooltip.rb +7 -0
  16. data/examples/button_style_changed.rb +7 -0
  17. data/examples/button_styles_default.rb +6 -0
  18. data/examples/check.rb +2 -0
  19. data/examples/download_and_show_image.rb +3 -0
  20. data/examples/flags/finland.rb +15 -0
  21. data/examples/flags/italy.rb +11 -0
  22. data/examples/flags/mauritius.rb +14 -0
  23. data/examples/font_family.rb +17 -0
  24. data/examples/font_shorthand.rb +9 -0
  25. data/examples/gen.rb +12 -8
  26. data/examples/highlander.rb +3 -3
  27. data/examples/legacy/README.md +6 -0
  28. data/examples/legacy/not_checked/shoes-contrib/basic/shoes-notes.rb +1 -1
  29. data/examples/legacy/not_checked/shoes-manual/append.rb +10 -0
  30. data/examples/legacy/not_checked/shoes-manual/background_change.rb +12 -0
  31. data/examples/legacy/not_checked/shoes-manual/background_pattern.rb +5 -0
  32. data/examples/legacy/not_checked/shoes-manual/basic_app.rb +8 -0
  33. data/examples/legacy/not_checked/shoes-manual/border.rb +9 -0
  34. data/examples/legacy/not_checked/shoes-manual/builtins/FONTS.rb +5 -0
  35. data/examples/legacy/not_checked/shoes-manual/builtins/ask.rb +2 -0
  36. data/examples/legacy/not_checked/shoes-manual/builtins/ask_color.rb +5 -0
  37. data/examples/legacy/not_checked/shoes-manual/builtins/ask_open_file.rb +5 -0
  38. data/examples/legacy/not_checked/shoes-manual/builtins/ask_save_folder.rb +2 -0
  39. data/examples/legacy/not_checked/shoes-manual/builtins/confirm.rb +4 -0
  40. data/examples/legacy/not_checked/shoes-manual/builtins/debug.rb +2 -0
  41. data/examples/legacy/not_checked/shoes-manual/builtins/info.rb +3 -0
  42. data/examples/legacy/not_checked/shoes-manual/button.rb +9 -0
  43. data/examples/legacy/not_checked/shoes-manual/clear.rb +7 -0
  44. data/examples/legacy/not_checked/shoes-manual/custom_header.rb +13 -0
  45. data/examples/legacy/not_checked/shoes-manual/displace.rb +14 -0
  46. data/examples/legacy/not_checked/shoes-manual/edit_box.rb +8 -0
  47. data/examples/legacy/not_checked/shoes-manual/fill_pattern.rb +5 -0
  48. data/examples/legacy/not_checked/shoes-manual/fonts.rb +7 -0
  49. data/examples/legacy/not_checked/shoes-manual/gutter.rb +6 -0
  50. data/examples/legacy/not_checked/shoes-manual/image_web.rb +4 -0
  51. data/examples/legacy/not_checked/shoes-manual/keypress.rb +7 -0
  52. data/examples/legacy/not_checked/shoes-manual/list_box.rb +10 -0
  53. data/examples/legacy/not_checked/shoes-manual/motion.rb +10 -0
  54. data/examples/legacy/not_checked/shoes-manual/mouse.rb +8 -0
  55. data/examples/legacy/not_checked/shoes-manual/move.rb +14 -0
  56. data/examples/legacy/not_checked/shoes-manual/nested_ovals.rb +8 -0
  57. data/examples/legacy/not_checked/shoes-manual/oval.rb +7 -0
  58. data/examples/legacy/not_checked/shoes-manual/ovals.rb +6 -0
  59. data/examples/legacy/not_checked/shoes-manual/ovals_image.rb +8 -0
  60. data/examples/legacy/not_checked/shoes-manual/prepend.rb +7 -0
  61. data/examples/legacy/not_checked/shoes-manual/progress_bar.rb +10 -0
  62. data/examples/legacy/not_checked/shoes-manual/radio.rb +18 -0
  63. data/examples/legacy/not_checked/shoes-manual/radio_alternative_1.rb +7 -0
  64. data/examples/legacy/not_checked/shoes-manual/radio_alternative_2.rb +9 -0
  65. data/examples/legacy/not_checked/shoes-manual/rotate_rectangle.rb +6 -0
  66. data/examples/legacy/not_checked/shoes-manual/shape.rb +11 -0
  67. data/examples/legacy/not_checked/shoes-manual/static/avatar.png +0 -0
  68. data/examples/legacy/not_checked/shoes-manual/stroke.rb +5 -0
  69. data/examples/legacy/not_checked/shoes-manual/style.rb +3 -0
  70. data/examples/legacy/not_checked/shoes-manual/style_alternative_1.rb +4 -0
  71. data/examples/legacy/not_checked/shoes-manual/style_alternative_2.rb +5 -0
  72. data/examples/legacy/not_checked/shoes-manual/style_length.rb +5 -0
  73. data/examples/legacy/not_checked/shoes-manual/timer.rb +6 -0
  74. data/examples/legacy/not_checked/shoes-manual/trigger_window.rb +8 -0
  75. data/examples/legacy/not_checked/shoes-manual/window_owner.rb +8 -0
  76. data/examples/legacy/not_checked/simple/anim-shapes.rb +1 -1
  77. data/examples/legacy/not_checked/speedometer_app.rb +55 -0
  78. data/examples/legacy/working/shoes_manual/alert_button.rb +2 -0
  79. data/examples/legacy/working/shoes_manual/animate.rb +7 -0
  80. data/examples/legacy/working/shoes_manual/background_para.rb +4 -0
  81. data/examples/legacy/working/shoes_manual/button_alternative.rb +7 -0
  82. data/examples/legacy/working/shoes_manual/checkbox.rb +17 -0
  83. data/examples/legacy/working/shoes_manual/download.rb +12 -0
  84. data/examples/legacy/working/shoes_manual/edit_box.rb +6 -0
  85. data/examples/legacy/working/shoes_manual/editline.rb +7 -0
  86. data/examples/legacy/working/shoes_manual/fixed_height.rb +8 -0
  87. data/examples/legacy/working/shoes_manual/fixed_width.rb +12 -0
  88. data/examples/legacy/working/shoes_manual/image.rb +5 -0
  89. data/examples/legacy/working/shoes_manual/instance_variable_check.rb +10 -0
  90. data/examples/legacy/working/shoes_manual/message.rb +18 -0
  91. data/examples/legacy/working/shoes_manual/rectangle.rb +6 -0
  92. data/examples/legacy/working/shoes_manual/save_download.rb +12 -0
  93. data/examples/legacy/working/shoes_manual/self_check.rb +10 -0
  94. data/examples/legacy/working/shoes_manual/stack.rb +7 -0
  95. data/examples/legacy/working/shoes_manual/style_info.rb +8 -0
  96. data/examples/legacy/working/shoes_manual/utf8_support.rb +8 -0
  97. data/examples/legacy/working/shoes_manual/width.rb +4 -0
  98. data/examples/legacy/working/simple/image-icon.rb +3 -0
  99. data/examples/legacy/{not_checked → working}/simple/image.rb +1 -1
  100. data/examples/list_box_choose.rb +17 -0
  101. data/examples/local_assets/local_file_server.rb +82 -0
  102. data/examples/local_assets/multi_image.rb +5 -0
  103. data/examples/local_assets/sample.gif +0 -0
  104. data/examples/local_assets/sample.mp4 +0 -0
  105. data/examples/local_assets/small.png +0 -0
  106. data/examples/local_fonts.rb +5 -2
  107. data/examples/local_images.rb +2 -3
  108. data/examples/margin.rb +13 -0
  109. data/examples/margin_check.rb +27 -0
  110. data/examples/oval-with-kwargs.rb +3 -0
  111. data/examples/oval.rb +26 -0
  112. data/examples/para/para_text.rb +14 -0
  113. data/examples/para_font_styles.rb +17 -0
  114. data/examples/para_font_variant.rb +6 -0
  115. data/examples/para_fontweight.rb +13 -0
  116. data/examples/parse_xl_funnies.rb +3 -0
  117. data/examples/progress.rb +31 -0
  118. data/examples/radio/radio_groups.rb +2 -2
  119. data/examples/rect.rb +4 -0
  120. data/examples/rotate_shapes.rb +17 -0
  121. data/examples/scarpe_ext.rb +3 -0
  122. data/examples/shapes/star.rb +1 -3
  123. data/examples/simpler-menu.rb +21 -0
  124. data/examples/spacing.rb +1 -1
  125. data/examples/span.rb +4 -2
  126. data/exe/scarpe +2 -1
  127. data/lacci/Gemfile +2 -0
  128. data/lacci/Gemfile.lock +8 -1
  129. data/lacci/lacci.gemspec +2 -2
  130. data/lacci/lib/lacci/scarpe_cli.rb +2 -2
  131. data/lacci/lib/lacci/scarpe_core.rb +2 -1
  132. data/lacci/lib/lacci/version.rb +1 -1
  133. data/lacci/lib/scarpe/niente/app.rb +23 -0
  134. data/lacci/lib/scarpe/niente/display_service.rb +66 -0
  135. data/lacci/lib/scarpe/niente/drawable.rb +59 -0
  136. data/lacci/lib/scarpe/niente/shoes_spec.rb +93 -0
  137. data/lacci/lib/scarpe/niente.rb +32 -0
  138. data/lacci/lib/shoes/app.rb +111 -72
  139. data/lacci/lib/shoes/background.rb +2 -2
  140. data/lacci/lib/shoes/border.rb +2 -2
  141. data/lacci/lib/shoes/builtins.rb +63 -0
  142. data/lacci/lib/shoes/changelog.rb +52 -0
  143. data/lacci/lib/shoes/colors.rb +3 -1
  144. data/lacci/lib/shoes/constants.rb +41 -2
  145. data/lacci/lib/shoes/display_service.rb +80 -18
  146. data/lacci/lib/shoes/download.rb +2 -2
  147. data/lacci/lib/shoes/drawable.rb +654 -0
  148. data/lacci/lib/shoes/drawables/arc.rb +27 -0
  149. data/lacci/lib/shoes/drawables/arrow.rb +21 -0
  150. data/lacci/lib/shoes/drawables/border.rb +28 -0
  151. data/lacci/lib/shoes/drawables/button.rb +57 -0
  152. data/lacci/lib/shoes/drawables/check.rb +33 -0
  153. data/lacci/lib/shoes/drawables/document_root.rb +20 -0
  154. data/lacci/lib/shoes/{widgets → drawables}/edit_box.rb +9 -8
  155. data/lacci/lib/shoes/{widgets → drawables}/edit_line.rb +8 -7
  156. data/lacci/lib/shoes/drawables/flow.rb +20 -0
  157. data/lacci/lib/shoes/drawables/font_helper.rb +62 -0
  158. data/lacci/lib/shoes/{widgets → drawables}/image.rb +7 -7
  159. data/lacci/lib/shoes/drawables/line.rb +17 -0
  160. data/lacci/lib/shoes/drawables/link.rb +31 -0
  161. data/lacci/lib/shoes/drawables/list_box.rb +59 -0
  162. data/lacci/lib/shoes/drawables/oval.rb +48 -0
  163. data/lacci/lib/shoes/drawables/para.rb +206 -0
  164. data/lacci/lib/shoes/drawables/progress.rb +15 -0
  165. data/lacci/lib/shoes/drawables/radio.rb +35 -0
  166. data/lacci/lib/shoes/drawables/rect.rb +18 -0
  167. data/lacci/lib/shoes/{widgets → drawables}/shape.rb +8 -8
  168. data/lacci/lib/shoes/drawables/slot.rb +178 -0
  169. data/lacci/lib/shoes/drawables/stack.rb +21 -0
  170. data/lacci/lib/shoes/drawables/star.rb +28 -0
  171. data/lacci/lib/shoes/drawables/subscription_item.rb +93 -0
  172. data/lacci/lib/shoes/drawables/text_drawable.rb +122 -0
  173. data/lacci/lib/shoes/drawables/video.rb +17 -0
  174. data/lacci/lib/shoes/drawables/widget.rb +74 -0
  175. data/lacci/lib/shoes/drawables.rb +32 -0
  176. data/lacci/lib/shoes/errors.rb +38 -0
  177. data/lacci/lib/shoes/log.rb +2 -2
  178. data/lacci/lib/shoes/margin_helper.rb +79 -0
  179. data/lacci/lib/shoes/ruby_extensions.rb +15 -0
  180. data/lacci/lib/shoes-spec.rb +93 -0
  181. data/lacci/lib/shoes.rb +31 -10
  182. data/lacci/test/.gitignore +1 -0
  183. data/lacci/test/test_draw_context.rb +167 -0
  184. data/lacci/test/test_font_helper.rb +57 -0
  185. data/lacci/test/test_helper.rb +81 -0
  186. data/lacci/test/test_lacci.rb +99 -3
  187. data/lacci/test/test_margin_helper.rb +82 -0
  188. data/lacci/test/test_niente_test_infra.rb +26 -0
  189. data/lacci/test/test_oval.rb +82 -0
  190. data/lacci/test/test_parenting.rb +140 -0
  191. data/lacci/test/test_shoes_errors.rb +49 -0
  192. data/lacci/test/test_text_drawables.rb +23 -0
  193. data/lib/scarpe/assets.rb +18 -0
  194. data/lib/scarpe/cats_cradle.rb +84 -103
  195. data/lib/scarpe/errors.rb +77 -0
  196. data/lib/scarpe/shoes_spec.rb +160 -0
  197. data/lib/scarpe/version.rb +2 -2
  198. data/lib/scarpe/wv/app.rb +21 -20
  199. data/lib/scarpe/wv/arc.rb +4 -51
  200. data/lib/scarpe/wv/arrow.rb +9 -0
  201. data/lib/scarpe/wv/border.rb +9 -18
  202. data/lib/scarpe/wv/button.rb +7 -35
  203. data/lib/scarpe/wv/check.rb +3 -5
  204. data/lib/scarpe/wv/control_interface.rb +20 -30
  205. data/lib/scarpe/wv/document_root.rb +81 -4
  206. data/lib/scarpe/wv/{widget.rb → drawable.rb} +71 -82
  207. data/lib/scarpe/wv/edit_box.rb +8 -18
  208. data/lib/scarpe/wv/edit_line.rb +9 -20
  209. data/lib/scarpe/wv/flow.rb +2 -18
  210. data/lib/scarpe/wv/image.rb +7 -30
  211. data/lib/scarpe/wv/line.rb +3 -25
  212. data/lib/scarpe/wv/link.rb +6 -17
  213. data/lib/scarpe/wv/list_box.rb +6 -29
  214. data/lib/scarpe/wv/oval.rb +13 -0
  215. data/lib/scarpe/wv/para.rb +12 -30
  216. data/lib/scarpe/wv/progress.rb +19 -0
  217. data/lib/scarpe/wv/radio.rb +9 -10
  218. data/lib/scarpe/wv/rect.rb +13 -0
  219. data/lib/scarpe/wv/scarpe_extensions.rb +8 -0
  220. data/lib/scarpe/wv/shape.rb +13 -13
  221. data/lib/scarpe/wv/slot.rb +8 -25
  222. data/lib/scarpe/wv/stack.rb +2 -18
  223. data/lib/scarpe/wv/star.rb +3 -53
  224. data/lib/scarpe/wv/subscription_item.rb +38 -4
  225. data/lib/scarpe/wv/text_drawable.rb +90 -0
  226. data/lib/scarpe/wv/video.rb +15 -15
  227. data/lib/scarpe/wv/web_wrangler.rb +320 -328
  228. data/lib/scarpe/wv/webview_local_display.rb +52 -33
  229. data/lib/scarpe/wv/webview_relay_display.rb +12 -12
  230. data/lib/scarpe/wv/webview_relay_util.rb +7 -10
  231. data/lib/scarpe/wv/wv_display_worker.rb +2 -2
  232. data/lib/scarpe/wv.rb +52 -12
  233. data/lib/scarpe/wv_local.rb +1 -1
  234. data/lib/scarpe/wv_relay.rb +1 -1
  235. data/lib/scarpe.rb +1 -0
  236. data/logger/debug_web_wrangler.json +1 -1
  237. data/logger/scarpe_wv_test.json +1 -1
  238. data/scarpe-components/Gemfile +4 -1
  239. data/scarpe-components/Gemfile.lock +85 -0
  240. data/scarpe-components/README.md +2 -2
  241. data/scarpe-components/assets/bootstrap-themes/bootstrap-cerulean.css +12229 -0
  242. data/scarpe-components/assets/bootstrap-themes/bootstrap-cosmo.css +11810 -0
  243. data/scarpe-components/assets/bootstrap-themes/bootstrap-cyborg.css +12210 -0
  244. data/scarpe-components/assets/bootstrap-themes/bootstrap-darkly.css +12153 -0
  245. data/scarpe-components/assets/bootstrap-themes/bootstrap-flatly.css +12126 -0
  246. data/scarpe-components/assets/bootstrap-themes/bootstrap-icons.min.css +5 -0
  247. data/scarpe-components/assets/bootstrap-themes/bootstrap-journal.css +12099 -0
  248. data/scarpe-components/assets/bootstrap-themes/bootstrap-litera.css +12211 -0
  249. data/scarpe-components/assets/bootstrap-themes/bootstrap-lumen.css +12369 -0
  250. data/scarpe-components/assets/bootstrap-themes/bootstrap-lux.css +11928 -0
  251. data/scarpe-components/assets/bootstrap-themes/bootstrap-materia.css +13184 -0
  252. data/scarpe-components/assets/bootstrap-themes/bootstrap-minty.css +12177 -0
  253. data/scarpe-components/assets/bootstrap-themes/bootstrap-morph.css +12750 -0
  254. data/scarpe-components/assets/bootstrap-themes/bootstrap-pulse.css +11890 -0
  255. data/scarpe-components/assets/bootstrap-themes/bootstrap-quartz.css +12622 -0
  256. data/scarpe-components/assets/bootstrap-themes/bootstrap-sandstone.css +12201 -0
  257. data/scarpe-components/assets/bootstrap-themes/bootstrap-simplex.css +12186 -0
  258. data/scarpe-components/assets/bootstrap-themes/bootstrap-sketchy.css +12451 -0
  259. data/scarpe-components/assets/bootstrap-themes/bootstrap-slate.css +12492 -0
  260. data/scarpe-components/assets/bootstrap-themes/bootstrap-solar.css +12149 -0
  261. data/scarpe-components/assets/bootstrap-themes/bootstrap-spacelab.css +12266 -0
  262. data/scarpe-components/assets/bootstrap-themes/bootstrap-superhero.css +12216 -0
  263. data/scarpe-components/assets/bootstrap-themes/bootstrap-united.css +12077 -0
  264. data/scarpe-components/assets/bootstrap-themes/bootstrap-vapor.css +12549 -0
  265. data/scarpe-components/assets/bootstrap-themes/bootstrap-yeti.css +12325 -0
  266. data/scarpe-components/assets/bootstrap-themes/bootstrap-zephyr.css +12283 -0
  267. data/scarpe-components/assets/bootstrap-themes/bootstrap.bundle.min.js +7 -0
  268. data/scarpe-components/lib/scarpe/components/asset_server.rb +219 -0
  269. data/scarpe-components/lib/scarpe/components/base64.rb +23 -5
  270. data/scarpe-components/lib/scarpe/components/calzini/alert.rb +49 -0
  271. data/scarpe-components/lib/scarpe/components/calzini/art_drawables.rb +227 -0
  272. data/scarpe-components/lib/scarpe/components/calzini/border.rb +38 -0
  273. data/scarpe-components/lib/scarpe/components/calzini/button.rb +37 -0
  274. data/scarpe-components/lib/scarpe/components/calzini/misc.rb +136 -0
  275. data/scarpe-components/lib/scarpe/components/calzini/para.rb +237 -0
  276. data/scarpe-components/lib/scarpe/components/calzini/slots.rb +109 -0
  277. data/scarpe-components/lib/scarpe/components/calzini.rb +236 -0
  278. data/scarpe-components/lib/scarpe/components/errors.rb +24 -0
  279. data/scarpe-components/lib/scarpe/components/file_helpers.rb +1 -0
  280. data/scarpe-components/lib/scarpe/components/html.rb +134 -0
  281. data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +83 -0
  282. data/scarpe-components/lib/scarpe/components/minitest_import_runnable.rb +98 -0
  283. data/scarpe-components/lib/scarpe/components/minitest_result.rb +127 -0
  284. data/scarpe-components/lib/scarpe/components/modular_logger.rb +5 -5
  285. data/scarpe-components/lib/scarpe/components/print_logger.rb +22 -3
  286. data/scarpe-components/lib/scarpe/components/process_helpers.rb +37 -0
  287. data/scarpe-components/lib/scarpe/components/promises.rb +14 -14
  288. data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +36 -17
  289. data/scarpe-components/lib/scarpe/components/string_helpers.rb +10 -0
  290. data/scarpe-components/lib/scarpe/components/tiranti.rb +167 -0
  291. data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +48 -6
  292. data/scarpe-components/lib/scarpe/components/version.rb +2 -2
  293. data/scarpe-components/test/assets/big-image.png +0 -0
  294. data/scarpe-components/test/assets/big-stylesheet.css +497 -0
  295. data/scarpe-components/test/assets/little-image.png +0 -0
  296. data/scarpe-components/test/assets/little-stylesheet.css +1 -0
  297. data/scarpe-components/test/calzini/test_calzini_alert.rb +30 -0
  298. data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +105 -0
  299. data/scarpe-components/test/calzini/test_calzini_button.rb +54 -0
  300. data/scarpe-components/test/calzini/test_calzini_misc.rb +115 -0
  301. data/scarpe-components/test/calzini/test_calzini_para.rb +34 -0
  302. data/scarpe-components/test/calzini/test_calzini_slots.rb +85 -0
  303. data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +106 -0
  304. data/scarpe-components/test/calzini/test_various.rb +133 -0
  305. data/scarpe-components/test/mtr_data/exception.json +1 -0
  306. data/scarpe-components/test/mtr_data/fail_with_message.json +1 -0
  307. data/scarpe-components/test/mtr_data/skipped_no_message.json +1 -0
  308. data/scarpe-components/test/mtr_data/skipped_w_msg.json +1 -0
  309. data/scarpe-components/test/mtr_data/succeed_2_asserts.json +1 -0
  310. data/scarpe-components/test/test_asset_server.rb +72 -0
  311. data/scarpe-components/test/test_components.rb +31 -2
  312. data/scarpe-components/test/test_dimensions.rb +26 -0
  313. data/scarpe-components/test/test_helper.rb +20 -1
  314. data/scarpe-components/test/test_html.rb +65 -0
  315. data/scarpe-components/test/test_minitest_result.rb +68 -0
  316. data/scarpe-components/test/test_promises.rb +5 -4
  317. data/scarpe-components/test/test_segmented_app_files.rb +10 -6
  318. data/scarpegen.rb +14 -14
  319. data/sig/scarpe.rbs +1 -1
  320. data/tasks/check_html_fixtures.rb +140 -0
  321. data/tasks/regenerate_html_fixtures.rb +104 -0
  322. data/templates/basic_class_template.erb +13 -14
  323. data/templates/class_template_with_event_bind.erb +4 -4
  324. data/templates/class_template_with_shapes.erb +8 -28
  325. data/templates/example_template.erb +1 -1
  326. data/templates/module_template.erb +4 -4
  327. data/templates/webview_template.erb +3 -2
  328. metadata +286 -80
  329. data/examples/legacy/not_checked/shoes-contrib/elements/image-icon.rb +0 -3
  330. data/lacci/lib/shoes/spacing.rb +0 -9
  331. data/lacci/lib/shoes/widget.rb +0 -218
  332. data/lacci/lib/shoes/widgets/alert.rb +0 -19
  333. data/lacci/lib/shoes/widgets/arc.rb +0 -51
  334. data/lacci/lib/shoes/widgets/button.rb +0 -35
  335. data/lacci/lib/shoes/widgets/check.rb +0 -28
  336. data/lacci/lib/shoes/widgets/document_root.rb +0 -20
  337. data/lacci/lib/shoes/widgets/flow.rb +0 -22
  338. data/lacci/lib/shoes/widgets/font.rb +0 -14
  339. data/lacci/lib/shoes/widgets/line.rb +0 -18
  340. data/lacci/lib/shoes/widgets/link.rb +0 -25
  341. data/lacci/lib/shoes/widgets/list_box.rb +0 -25
  342. data/lacci/lib/shoes/widgets/para.rb +0 -68
  343. data/lacci/lib/shoes/widgets/radio.rb +0 -35
  344. data/lacci/lib/shoes/widgets/slot.rb +0 -75
  345. data/lacci/lib/shoes/widgets/span.rb +0 -26
  346. data/lacci/lib/shoes/widgets/stack.rb +0 -24
  347. data/lacci/lib/shoes/widgets/star.rb +0 -44
  348. data/lacci/lib/shoes/widgets/subscription_item.rb +0 -60
  349. data/lacci/lib/shoes/widgets/text_widget.rb +0 -51
  350. data/lacci/lib/shoes/widgets/video.rb +0 -15
  351. data/lacci/lib/shoes/widgets.rb +0 -29
  352. data/lib/scarpe/evented_assertions.rb +0 -88
  353. data/lib/scarpe/wv/alert.rb +0 -66
  354. data/lib/scarpe/wv/background.rb +0 -27
  355. data/lib/scarpe/wv/control_interface_test.rb +0 -238
  356. data/lib/scarpe/wv/dimensions.rb +0 -22
  357. data/lib/scarpe/wv/font.rb +0 -36
  358. data/lib/scarpe/wv/html.rb +0 -108
  359. data/lib/scarpe/wv/spacing.rb +0 -41
  360. data/lib/scarpe/wv/span.rb +0 -68
  361. data/lib/scarpe/wv/text_widget.rb +0 -30
  362. /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/definr.rb +0 -0
  363. /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/funnies.rb +0 -0
  364. /data/examples/legacy/not_checked/shoes-contrib/{elements → basic}/list_box-select-class.rb +0 -0
  365. /data/examples/legacy/{not_checked → working}/shoes3-tests/editline/editline.rb +0 -0
  366. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/basic-edit-box.rb +0 -0
  367. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/basic-fps.rb +0 -0
  368. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/border-cat.rb +0 -0
  369. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/check-mate.rb +0 -0
  370. /data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb +0 -0
  371. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/clock.rb +0 -0
  372. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/gradient-shoes.rb +0 -0
  373. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb +0 -0
  374. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/list_box.rb +0 -0
  375. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/phat-button.rb +0 -0
  376. /data/examples/legacy/{not_checked/shoes-contrib → working}/simple/simple-calc.rb +0 -0
  377. /data/examples/legacy/{not_checked/shoes-contrib/position → working/simple}/stack-width.rb +0 -0
  378. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb +0 -0
@@ -0,0 +1 @@
1
+ [{"name":"test_sspec","klass":"TestListBoxShoesSpecIntegration","assertions":1,"failures":[["exception","{\"json_class\":\"Minitest::Assertion\",\"m\":\"Fail with message\",\"b\":[\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/assertions.rb:183:in `assert'\",\"(eval):1:in `block in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `block in run_shoes_spec_test_code'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:102:in `block (3 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:199:in `capture_exceptions'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:97:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:296:in `time_it'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:96:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:247:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:95:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-reporters-1.6.0/lib/minitest/reporters.rb:48:in `run_with_hooks'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:1051:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:365:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:352:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `each'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:378:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:350:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `block in __run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `map'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `__run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:159:in `run'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:51:in `block (2 levels) in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `instance_eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `block in on_event'\"]}"]],"time":6.899982690811157e-05,"metadata":{},"source_location":["/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb",61]}]
@@ -0,0 +1 @@
1
+ [{"name":"test_sspec","klass":"TestListBoxShoesSpecIntegration","assertions":0,"failures":[["exception","{\"json_class\":\"Minitest::Skip\",\"m\":\"Skipped, no message given\",\"b\":[\"(eval):1:in `block in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `block in run_shoes_spec_test_code'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:102:in `block (3 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:199:in `capture_exceptions'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:97:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:296:in `time_it'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:96:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:247:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:95:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-reporters-1.6.0/lib/minitest/reporters.rb:48:in `run_with_hooks'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:1051:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:365:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:352:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `each'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:378:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:350:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `block in __run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `map'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `__run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:159:in `run'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:51:in `block (2 levels) in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `instance_eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `block in on_event'\"]}"]],"time":7.00000673532486e-05,"metadata":{},"source_location":["/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb",61]}]
@@ -0,0 +1 @@
1
+ [{"name":"test_sspec","klass":"TestListBoxShoesSpecIntegration","assertions":0,"failures":[["exception","{\"json_class\":\"Minitest::Skip\",\"m\":\"Just skipping\",\"b\":[\"(eval):1:in `block in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `block in run_shoes_spec_test_code'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:102:in `block (3 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:199:in `capture_exceptions'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:97:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:296:in `time_it'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:96:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:247:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:95:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-reporters-1.6.0/lib/minitest/reporters.rb:48:in `run_with_hooks'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:1051:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:365:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:352:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `each'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:378:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:350:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `block in __run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `map'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `__run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:159:in `run'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:51:in `block (2 levels) in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `instance_eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `block in on_event'\"]}"]],"time":7.899943739175797e-05,"metadata":{},"source_location":["/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb",61]}]
@@ -0,0 +1 @@
1
+ [{"name":"test_sspec","klass":"TestListBoxShoesSpecIntegration","assertions":2,"failures":[],"time":4.399940371513367e-05,"metadata":{},"source_location":["/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb",61]}]
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "test_helper"
4
+
5
+ require "scarpe/components/asset_server"
6
+
7
+ class TestAssetServer < Minitest::Test
8
+ def teardown
9
+ @server = nil # Don't keep the same server object from run to run, just in case
10
+ end
11
+
12
+ def fake_server
13
+ # We don't need to check HTTP connections, we just want to generate URLs
14
+ @server ||= Scarpe::Components::AssetServer.new port: 4444, app_dir: __dir__, never_start_server: true
15
+ end
16
+
17
+ def weird_dir_server
18
+ # Use a deeper app root to test files outside the app's directory
19
+ @server ||= Scarpe::Components::AssetServer.new port: 4444, app_dir: "#{__dir__}/subdir", never_start_server: true
20
+ end
21
+
22
+ def test_small_image_explicit_data_url
23
+ url = fake_server.asset_url("#{__dir__}/assets/little-image.png", url_type: :data)
24
+ assert url.start_with?("data:image/png;base64,"), "Data URL for image should start with image/png! #{url.inspect}"
25
+ end
26
+
27
+ def test_small_css_explicit_data_url
28
+ url = fake_server.asset_url("#{__dir__}/assets/little-stylesheet.css", url_type: :data)
29
+ assert url.start_with?("data:text/css;base64,"), "Data URL for CSS should start with text/css! #{url.inspect}"
30
+ end
31
+
32
+ def test_small_css_auto_data_url
33
+ url = fake_server.asset_url("#{__dir__}/assets/little-stylesheet.css")
34
+ assert url.start_with?("data:text/css;base64,"), "Small CSS files should get a data URL by default! #{url.inspect}"
35
+ end
36
+
37
+ def test_small_css_explicit_app_dir_asset_url
38
+ url = fake_server.asset_url("#{__dir__}/assets/little-stylesheet.css", url_type: :asset)
39
+ assert_equal "http://127.0.0.1:4444/app/assets/little-stylesheet.css", url, "Small CSS files should get an asset URL by request!"
40
+ end
41
+
42
+ def test_small_css_explicit_component_asset_url
43
+ url = weird_dir_server.asset_url("#{__dir__}/assets/little-stylesheet.css", url_type: :asset)
44
+ assert_equal "http://127.0.0.1:4444/comp/test/assets/little-stylesheet.css", url, "Small CSS files should get an asset URL by request!"
45
+ end
46
+
47
+ def test_large_app_file_auto_asset_url
48
+ url = fake_server.asset_url("#{__dir__}/assets/big-image.png")
49
+ assert_equal "http://127.0.0.1:4444/app/assets/big-image.png", url, "Big image files should get an asset URL by default!"
50
+ end
51
+
52
+ def test_large_app_file_explicit_asset_url
53
+ url = fake_server.asset_url("#{__dir__}/assets/big-image.png", url_type: :asset)
54
+ assert_equal "http://127.0.0.1:4444/app/assets/big-image.png", url, "Big image files should get an asset URL by default!"
55
+ end
56
+
57
+ def test_large_app_file_explicit_data_url
58
+ url = fake_server.asset_url("#{__dir__}/assets/big-image.png", url_type: :data)
59
+ assert url.start_with?("data:image/png;base64,"), "Big image files should get a data URL by request! #{url.inspect}"
60
+ end
61
+
62
+ def test_large_file_outside_dirs
63
+ url = fake_server.asset_url("#{__dir__}/../../docs/static/man-builds.png")
64
+ assert url.start_with?("data:image/png;base64,"), "Large files outside dirs should still use data URLs"
65
+ end
66
+
67
+ def test_large_file_outside_dirs_with_exception
68
+ assert_raises Scarpe::OperationNotAllowedError do
69
+ url = fake_server.asset_url("#{__dir__}/../../docs/static/man-builds.png", url_type: :asset)
70
+ end
71
+ end
72
+ end
@@ -3,7 +3,36 @@
3
3
  require_relative "test_helper"
4
4
 
5
5
  class TestScarpeComponents < Minitest::Test
6
- def test_truth
7
- assert_equal true, true
6
+ # Top-level tests go here?
7
+ end
8
+
9
+ require "scarpe/components/process_helpers"
10
+ class TestComponentHelpers < Minitest::Test
11
+ include Scarpe::Components::ProcessHelpers
12
+
13
+ def test_process_runner_stdout
14
+ out, err, success = run_out_err_result("echo ok")
15
+ assert success, "Echoing okay should succeed!"
16
+ assert_equal "", err
17
+ assert_includes out, "ok"
18
+ end
19
+
20
+ def test_process_runner_stderr
21
+ out, err, success = run_out_err_result("echo ok 1>&2")
22
+ assert success, "Echoing okay to stderr should succeed!"
23
+ assert_equal "", out
24
+ assert_includes err, "ok"
25
+ end
26
+
27
+ def test_process_runner_fail
28
+ out, err, success = run_out_err_result("ls no_such_file_exists")
29
+ assert !success, "ls on nonexistent file should return failure!"
30
+ assert_equal "", out
31
+ assert err != "", "ls on nonexistent file should give non-empty error output"
32
+ end
33
+
34
+ def test_process_runner_command_array
35
+ out, err, success = run_out_err_result(["echo", "ok"])
36
+ assert success, "Echoing okay via command array should succeed!"
8
37
  end
9
38
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+ require "scarpe/components/calzini"
5
+
6
+ class TestDimensions < Minitest::Test
7
+ def test_no_value_returns_nil
8
+ assert_nil ::Scarpe::Components::Calzini.dimensions_length(nil)
9
+ end
10
+
11
+ def test_integer_value_returns_px
12
+ assert_equal "100px", ::Scarpe::Components::Calzini.dimensions_length(100)
13
+ end
14
+
15
+ def test_negative_integer_value_returns_calc
16
+ assert_equal "calc(100% - 100px)", ::Scarpe::Components::Calzini.dimensions_length(-100)
17
+ end
18
+
19
+ def test_float_value_returns_percent
20
+ assert_equal "100.0%", ::Scarpe::Components::Calzini.dimensions_length(1.0)
21
+ end
22
+
23
+ def test_otherwise_you_get_what_you_give
24
+ assert_equal "banana", ::Scarpe::Components::Calzini.dimensions_length("banana")
25
+ end
26
+ end
@@ -2,6 +2,9 @@
2
2
 
3
3
  $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
4
 
5
+ # Prevent Calzini or Tiranti from registering itself with Scarpe::Webview, which isn't present here
6
+ ENV["SCARPE_HTML_RENDERER"] = "NONE"
7
+
5
8
  require "shoes"
6
9
 
7
10
  require "minitest/autorun"
@@ -18,6 +21,22 @@ Shoes::Log.configure_logger(Shoes::Log::DEFAULT_LOG_CONFIG)
18
21
 
19
22
  require "scarpe/components/unit_test_helpers"
20
23
 
24
+ require "scarpe/components/calzini"
25
+
26
+ class CalziniRenderer
27
+ include Scarpe::Components::Calzini
28
+
29
+ attr_accessor :html_id
30
+
31
+ def initialize
32
+ @html_id = "elt-1"
33
+ end
34
+
35
+ def handler_js_code(event, *args)
36
+ js_args = ["'#{event}'", *args].join(", ")
37
+ "handle(#{js_args})"
38
+ end
39
+ end
40
+
21
41
  class Minitest::Test
22
- include Scarpe::Test::Helpers
23
42
  end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+ require "scarpe/components/html"
5
+
6
+ class TestHTML < Minitest::Test
7
+ def test_works_without_content
8
+ subject = ::Scarpe::Components::HTML.render(&:div)
9
+
10
+ assert_equal "<div></div>", subject
11
+ end
12
+
13
+ def test_works_for_pure_tags
14
+ subject = Scarpe::Components::HTML.render { |h| h.div { "foo" } }
15
+
16
+ assert_equal "<div>foo</div>", subject
17
+ end
18
+
19
+ def test_works_for_classes
20
+ subject = Scarpe::Components::HTML.render { |h| h.div(class: "container") { "foo" } }
21
+
22
+ assert_equal '<div class="container">foo</div>', subject
23
+ end
24
+
25
+ def test_works_for_style
26
+ subject = Scarpe::Components::HTML.render { |h| h.div(style: { display: "block", width: "100px" }) { "foo" } }
27
+
28
+ assert_equal '<div style="display:block;width:100px">foo</div>', subject
29
+ end
30
+
31
+ def test_works_for_string_style
32
+ subject = Scarpe::Components::HTML.render { |h| h.div(style: "display:block;width:100px") { "foo" } }
33
+
34
+ assert_equal '<div style="display:block;width:100px">foo</div>', subject
35
+ end
36
+
37
+ def test_no_style_if_style_empty
38
+ subject = ::Scarpe::Components::HTML.render { |h| h.div(style: {}) { "foo" } }
39
+
40
+ assert_equal "<div>foo</div>", subject
41
+ end
42
+
43
+ def test_works_with_multiple_children
44
+ subject = Scarpe::Components::HTML.render do |h|
45
+ h.ul do
46
+ h.li { "one" }
47
+ h.li { "two" }
48
+ end
49
+ end
50
+
51
+ assert_equal "<ul><li>one</li><li>two</li></ul>", subject
52
+ end
53
+
54
+ def test_works_with_void_tag
55
+ subject = Scarpe::Components::HTML.render { |h| h.input(type: "text") }
56
+
57
+ assert_equal '<input type="text" />', subject
58
+ end
59
+
60
+ def test_raises_with_void_tag_blocks
61
+ assert_raises(Shoes::Errors::InvalidAttributeValueError, "void tag input cannot have content") do
62
+ Scarpe::Components::HTML.render { |h| h.input(type: "text") { "foo" } }
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "test_helper"
4
+
5
+ require "scarpe/components/minitest_result"
6
+
7
+ class TestMinitestResult < Minitest::Test
8
+ def test_mtr_success
9
+ path = File.join __dir__, "mtr_data/succeed_2_asserts.json"
10
+ res = Scarpe::Components::MinitestResult.new(path)
11
+
12
+ refute res.error?
13
+ refute res.fail?
14
+ refute res.skip?
15
+ assert res.passed?, "Passing result with two assertions should count as passing!"
16
+ assert_equal 2, res.assertions
17
+ end
18
+
19
+ def test_mtr_failure
20
+ path = File.join __dir__, "mtr_data/fail_with_message.json"
21
+ res = Scarpe::Components::MinitestResult.new(path)
22
+
23
+ refute res.error?, "Fail-with-message data should not be an error!"
24
+ assert res.fail?, "Fail-with-message data should be a failure!"
25
+ refute res.skip?
26
+ refute res.passed?
27
+ assert_equal "Fail with message", res.fail_message
28
+ end
29
+
30
+ def test_mtr_error
31
+ path = File.join __dir__, "mtr_data/exception.json"
32
+ res = Scarpe::Components::MinitestResult.new(path)
33
+
34
+ assert res.error?, "Exception data should show an error!"
35
+ refute res.fail?, "Exception data should not be an assertion failure!"
36
+ refute res.skip?
37
+ refute res.passed?
38
+ assert res.error_message.include?("This is an exception"), "Error msg data should include the exception message"
39
+ end
40
+
41
+ def test_mtr_skip_no_msg
42
+ path = File.join __dir__, "mtr_data/skipped_no_message.json"
43
+ res = Scarpe::Components::MinitestResult.new(path)
44
+
45
+ refute res.error?, "Skipped data should not be an error!"
46
+ refute res.fail?, "Skipped data should not be a failure!"
47
+ assert res.skip?, "Skipped data should count as skipped"
48
+ refute res.passed?
49
+ end
50
+
51
+ def test_mtr_skip_w_msg
52
+ path = File.join __dir__, "mtr_data/skipped_w_msg.json"
53
+ res = Scarpe::Components::MinitestResult.new(path)
54
+
55
+ refute res.error?, "Skipped data should not be an error!"
56
+ refute res.fail?, "Skipped data should not be a failure!"
57
+ assert res.skip?, "Skipped data should count as skipped"
58
+ refute res.passed?
59
+ assert_equal "Just skipping", res.skip_message
60
+ end
61
+
62
+ def test_mtr_console_summary
63
+ path = File.join __dir__, "mtr_data/skipped_w_msg.json"
64
+ res = Scarpe::Components::MinitestResult.new(path)
65
+
66
+ assert res.console_summary.include?("Skip:")
67
+ end
68
+ end
@@ -6,18 +6,19 @@ require "scarpe/components/promises"
6
6
 
7
7
  class TestPromises < Minitest::Test
8
8
  Promise = Scarpe::Promise
9
+ PrintLogger = Scarpe::Components::PrintLogImpl::PrintLogger
9
10
 
10
11
  def setup
11
12
  # Save so we can restore it post-test
12
- @normal_log_config = Shoes::Log.current_log_config
13
+ @silenced = PrintLogger.silence
13
14
 
14
15
  # For these tests, don't log anything
15
- Shoes::Log.configure_logger("default" => "fatal")
16
+ PrintLogger.silence = true
16
17
  end
17
18
 
18
19
  def teardown
19
- # Restore previous log config
20
- Shoes::Log.configure_logger(@normal_log_config)
20
+ # Restore previous log state
21
+ PrintLogger.silence = @silenced
21
22
  end
22
23
 
23
24
  def empty_promise_with_checker(state: nil, parents: [])
@@ -7,6 +7,8 @@ require "scarpe/components/segmented_file_loader"
7
7
  SEG_TEST_DATA = {}
8
8
 
9
9
  class TestSegmentedAppFiles < Minitest::Test
10
+ include Scarpe::Test::Helpers
11
+
10
12
  def setup
11
13
  @orig_file_loaders = Shoes.file_loaders
12
14
  Shoes.reset_file_loaders # create new loaders array with no overlap with @orig_file_loaders
@@ -61,13 +63,15 @@ class TestSegmentedAppFiles < Minitest::Test
61
63
  assert_equal({ app_ran: true }, SEG_TEST_DATA)
62
64
  end
63
65
 
66
+ # TODO: this test is partially updated to ShoesSpec rather
67
+ # than CatsCradle, but we could use a proper version.
64
68
  def test_default_double_segment_with_front_matter
65
69
  app = <<~SEG_TEST_FILE
66
70
  ---
67
71
  front_matter: yes
68
72
  ----- app code
69
73
  SEG_TEST_DATA[:app_ran] = true
70
- eval File.read(ENV['SCARPE_APP_TEST']) # run test code
74
+ eval File.read(ENV['SHOES_SPEC_TEST']) # run test code
71
75
  ----- test code
72
76
  SEG_TEST_DATA[:test_ran] = true
73
77
  SEG_TEST_FILE
@@ -83,7 +87,7 @@ class TestSegmentedAppFiles < Minitest::Test
83
87
  ---
84
88
  ----- app code
85
89
  SEG_TEST_DATA[:app_ran] = true
86
- eval File.read(ENV['SCARPE_APP_TEST']) # run test code
90
+ eval File.read(ENV['SHOES_SPEC_TEST']) # run test code
87
91
  ----- test code
88
92
  SEG_TEST_DATA[:test_ran] = true
89
93
  SEG_TEST_FILE
@@ -98,7 +102,7 @@ class TestSegmentedAppFiles < Minitest::Test
98
102
  app = <<~SEG_TEST_FILE
99
103
  ----- app code
100
104
  SEG_TEST_DATA[:app_ran] = true
101
- eval File.read(ENV['SCARPE_APP_TEST']) # run test code
105
+ eval File.read(ENV['SHOES_SPEC_TEST']) # run test code
102
106
  ----- test code
103
107
  SEG_TEST_DATA[:test_ran] = true
104
108
  SEG_TEST_FILE
@@ -113,7 +117,7 @@ class TestSegmentedAppFiles < Minitest::Test
113
117
  app = <<~SEG_TEST_FILE
114
118
  -----
115
119
  SEG_TEST_DATA[:app_ran] = true
116
- eval File.read(ENV['SCARPE_APP_TEST']) # run test code
120
+ eval File.read(ENV['SHOES_SPEC_TEST']) # run test code
117
121
  -----
118
122
  SEG_TEST_DATA[:test_ran] = true
119
123
  SEG_TEST_FILE
@@ -127,7 +131,7 @@ class TestSegmentedAppFiles < Minitest::Test
127
131
  def test_default_double_segment_no_front_matter_no_initial_name
128
132
  app = <<~SEG_TEST_FILE
129
133
  SEG_TEST_DATA[:app_ran] = true
130
- eval File.read(ENV['SCARPE_APP_TEST']) # run test code
134
+ eval File.read(ENV['SHOES_SPEC_TEST']) # run test code
131
135
  ----- test code
132
136
  SEG_TEST_DATA[:test_ran] = true
133
137
  SEG_TEST_FILE
@@ -144,7 +148,7 @@ class TestSegmentedAppFiles < Minitest::Test
144
148
  front_matter: yes
145
149
  ---------------- app code
146
150
  SEG_TEST_DATA[:app_ran] = true
147
- eval File.read(ENV['SCARPE_APP_TEST']) # run test code
151
+ eval File.read(ENV['SHOES_SPEC_TEST']) # run test code
148
152
  ------- test code
149
153
  SEG_TEST_DATA[:test_ran] = true
150
154
  SEG_TEST_FILE
data/scarpegen.rb CHANGED
@@ -5,7 +5,7 @@ require "erb"
5
5
  class ScarpeGenerator
6
6
  def initialize
7
7
  @filename = ""
8
- @display_properties = ""
8
+ @shoes_styles = ""
9
9
  end
10
10
 
11
11
  def generate
@@ -14,7 +14,7 @@ class ScarpeGenerator
14
14
  choice = get_choice
15
15
  if choice == "1"
16
16
  class_template_choice = get_class_template_choice
17
- get_display_properties if class_template_choice != "1"
17
+ get_shoes_styles if class_template_choice != "1"
18
18
  end
19
19
  generate_files(choice, class_template_choice)
20
20
  end
@@ -89,14 +89,14 @@ class ScarpeGenerator
89
89
  end
90
90
  end
91
91
 
92
- def get_display_properties
93
- print "\n\e[33mDo you want to enter display properties? (y/n):\e[0m "
92
+ def get_shoes_styles
93
+ print "\n\e[33mDo you want to enter Shoes styles? (y/n):\e[0m "
94
94
  response = gets.chomp.downcase
95
- @display_properties = response == "y" || response == "yes" ? get_properties_input : ":dummy"
95
+ @shoes_styles = response == "y" || response == "yes" ? get_properties_input : ":dummy"
96
96
  end
97
97
 
98
98
  def get_properties_input
99
- print "\e[33mEnter the display properties:(enter like :width,:height)\e[0m "
99
+ print "\e[33mEnter the Shoes styles:(enter like :width,:height)\e[0m "
100
100
  gets.chomp
101
101
  end
102
102
 
@@ -112,20 +112,20 @@ class ScarpeGenerator
112
112
  end
113
113
  generate_webview_file
114
114
  generate_example_file
115
- add_require_relative_to_widgets_file
115
+ add_require_relative_to_drawables_file
116
116
  puts "\n\e[1;32mYayyyy! Files generated successfully!\e[0m\n"
117
117
  end
118
118
 
119
- def add_require_relative_to_widgets_file
120
- widgets_file_path = "lib/scarpe/widgets.rb"
119
+ def add_require_relative_to_drawables_file
120
+ drawables_file_path = "lacci/lib/shoes/drawables.rb"
121
121
  filename = @filename.downcase
122
- require_line = "require_relative \"#{filename}\""
122
+ require_line = "require \"shoes/drawables/#{filename}\""
123
123
 
124
- File.open(widgets_file_path, "a") do |file|
124
+ File.open(drawables_file_path, "a") do |file|
125
125
  file.puts require_line
126
126
  end
127
127
 
128
- puts "Added require_relative to widgets.rb file"
128
+ puts "Added require_relative to drawables.rb file"
129
129
  end
130
130
 
131
131
  def generate_webview_file
@@ -169,7 +169,7 @@ class ScarpeGenerator
169
169
  class_template = File.read(class_template_file)
170
170
  class_content = ERB.new(class_template).result(binding_with_argument(class_template_choice))
171
171
 
172
- File.write("lib/scarpe/#{@filename}.rb", class_content)
172
+ File.write("lacci/lib/shoes/drawables/#{@filename}.rb", class_content)
173
173
  end
174
174
 
175
175
  def generate_module_file
@@ -183,7 +183,7 @@ class ScarpeGenerator
183
183
  capitalized_argument = @filename.capitalize
184
184
  binding.dup.tap do |b|
185
185
  b.local_variable_set(:argument, capitalized_argument)
186
- b.local_variable_set(:display_properties, @display_properties)
186
+ b.local_variable_set(:shoes_styles, @shoes_styles)
187
187
  b.local_variable_set(:class_template_choice, class_template_choice) unless class_template_choice.nil?
188
188
  end
189
189
  end
data/sig/scarpe.rbs CHANGED
@@ -1,4 +1,4 @@
1
- class Scarpe
1
+ module Scarpe
2
2
  VERSION: String
3
3
  # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
4
  end
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: false
2
+ require 'diff/lcs'
3
+ require 'diff/lcs/hunk'
4
+ require 'fileutils'
5
+ require "htmlbeautifier"
6
+
7
+ puts "== Checking HTML fixtures =="
8
+
9
+
10
+ # Get top-level Ruby examples
11
+ file_paths = Dir["examples/*.rb"]
12
+
13
+ # Get each filename, or one if supplied as argument
14
+ file_names = if ENV['SELECTED_FILE']
15
+ [ENV['SELECTED_FILE']]
16
+ else
17
+ file_paths.map do |file|
18
+ File.basename(file) # Exclude the file extension
19
+ end
20
+ end
21
+
22
+ collection_of_html = []
23
+ any_failures = false
24
+ failures = []
25
+
26
+ # ASCII color and format codes
27
+ red = "\e[31m"
28
+ green = "\e[32m"
29
+ bold = "\e[1m"
30
+ reset = "\e[0m"
31
+
32
+ def diff_as_string(data_new, data_old, file_name)
33
+ data_old = data_old.split(/\n/).map! { |e| e.chomp }
34
+ data_new = data_new.split(/\n/).map! { |e| e.chomp }
35
+
36
+ diffs = Diff::LCS.diff(data_old, data_new)
37
+ return if diffs.empty?
38
+
39
+ context_lines = 1
40
+
41
+ oldhunk = hunk = nil
42
+ file_length_difference = 0
43
+
44
+ output = ""
45
+ diffs.each do |piece|
46
+ begin
47
+ hunk = Diff::LCS::Hunk.new(data_old, data_new, piece,
48
+ context_lines,
49
+ file_length_difference
50
+ )
51
+ file_length_difference = hunk.file_length_difference
52
+
53
+ next unless oldhunk
54
+
55
+ # Hunks may overlap, which is why we need to be careful when our
56
+ # diff includes lines of context. Otherwise, we might print
57
+ # redundant lines.
58
+ if (context_lines > 0) and hunk.overlaps?(oldhunk)
59
+ hunk.unshift(oldhunk)
60
+ else
61
+ output << oldhunk.diff(:unified, "#{file_name}:") << "\n"
62
+ end
63
+ ensure
64
+ oldhunk = hunk
65
+ end
66
+ end
67
+
68
+ #Handle the last remaining hunk
69
+ output << oldhunk.diff(:unified, "#{file_name}:") << "\n"
70
+ end
71
+
72
+ file_names.each do |file_name|
73
+ # Read the entire file
74
+ content = File.read(File.join(File.expand_path("../examples", __dir__),"#{file_name}"))
75
+ # Skip this file if it contains the magic comment
76
+ next if content.include?("# html_ci: false")
77
+
78
+ output = ""
79
+ pid = nil
80
+ command = "bundle exec ./exe/scarpe examples/#{file_name} --dev --debug"
81
+
82
+ IO.popen(command) do |io|
83
+ pid = io.pid # captures the pid of the child process
84
+ io.each_line do |line|
85
+ output << line
86
+ if line.include?(":heartbeat")
87
+ Process.kill("SIGKILL", pid)
88
+ break
89
+ end
90
+ end
91
+ end
92
+
93
+ def match_output(logs)
94
+ logs.match(/(?<=code_string = ").*(?=")/)[0].split("`")[1]
95
+ end
96
+
97
+ def format_html(html)
98
+ html.gsub!(/\\/, "") # Remove all backslashes
99
+ html
100
+ end
101
+
102
+ html = format_html(
103
+ match_output(output),
104
+ )
105
+ # puts formatted_html
106
+ pretty_html = HtmlBeautifier.beautify(html)
107
+
108
+ # Compare to fixture
109
+ dir_path = "test/wv/html_fixtures"
110
+ begin
111
+ file_path = "#{dir_path}/#{file_name.split(".")[0]}.html"
112
+ expected_output = File.read(file_path)
113
+ rescue => e
114
+ raise "Hey, you need to regenerate fixtures, do this using command 'rake test:regenerate_html_fixtures' "
115
+ end
116
+ # Do the comparison
117
+ # diff = Diff::LCS.diff(pretty_html, expected_output)
118
+ diff_output = diff_as_string(pretty_html, expected_output, file_name)
119
+
120
+ if diff_output.nil?
121
+ puts "#{green}#{bold}PASSED#{reset}: #{file_name}"
122
+ else
123
+ puts "#{red}#{bold}FAILED#{reset}: #{file_name}\nDiff:"
124
+ puts diff_output
125
+ print reset
126
+ failures << file_name # Add name of failed file to the array
127
+ end
128
+ end
129
+
130
+ unless failures.empty?
131
+ puts "\n=== #{bold}Summary#{reset} ==="
132
+ puts "The following files have had their HTML output change with your changes"
133
+ puts "This may indicate an error. Please check the diff and update the fixture if necessary."
134
+ puts "You can update the fixture by running #{bold}`rake test:regenerate_html_fixtures`#{reset}\n\n"
135
+ failures.each do |file|
136
+ puts "#{red}#{file}#{reset}"
137
+ end
138
+ exit 1
139
+ end
140
+ puts "== Completed HTML fixture check =="