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
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Stack < Shoes::Slot
5
- include Shoes::Background
6
- include Shoes::Border
7
- include Shoes::Spacing
8
-
9
- # TODO: sort out various margin and padding properties, including putting stuff into spacing
10
- display_properties :width, :height, :scroll
11
-
12
- def initialize(width: nil, height: nil, margin: nil, padding: nil, scroll: false, margin_top: nil, margin_bottom: nil, margin_left: nil,
13
- margin_right: nil, **options, &block)
14
-
15
- @options = options
16
-
17
- super
18
-
19
- create_display_widget
20
- # Create the display-side widget *before* running the block, which will add child widgets with their display widgets
21
- Shoes::App.instance.with_slot(self, &block) if block_given?
22
- end
23
- end
24
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Star < Shoes::Widget
5
- display_properties :left, :top, :points, :outer, :inner, :draw_context
6
-
7
- def initialize(left, top, points = 10, outer = 100, inner = 50)
8
- @points = convert_to_integer(points, "points", 10)
9
- @outer = convert_to_float(outer, "outer", 100.0)
10
- @inner = convert_to_float(inner, "inner", 50.0)
11
-
12
- @draw_context = Shoes::App.instance.current_draw_context
13
-
14
- super
15
- create_display_widget
16
- end
17
-
18
- private
19
-
20
- def convert_to_integer(value, attribute_name, default = 0)
21
- begin
22
- value = Integer(value)
23
- raise InvalidAttributeValueError, "Negative num '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
24
-
25
- value
26
- rescue ArgumentError
27
- error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
28
- raise InvalidAttributeValueError, error_message
29
- end
30
- end
31
-
32
- def convert_to_float(value, attribute_name, default = 0.0)
33
- begin
34
- value = Float(value)
35
- raise InvalidAttributeValueError, "Negative num '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
36
-
37
- value
38
- rescue ArgumentError
39
- error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
40
- raise InvalidAttributeValueError, error_message
41
- end
42
- end
43
- end
44
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Certain Shoes calls like motion and keydown are basically an
4
- # event subscription, with no other visible presence. However,
5
- # they have a place in the widget tree and can be deleted.
6
- #
7
- # Depending on the display library they may not have any
8
- # direct visual (or similar) presence there either.
9
- #
10
- # Inheriting from Widget gives these a parent slot and a
11
- # linkable_id automatically.
12
- class Shoes::SubscriptionItem < Shoes::Widget
13
- display_property :shoes_api_name
14
-
15
- def initialize(shoes_api_name:, &block)
16
- super
17
-
18
- @callback = block
19
-
20
- case shoes_api_name
21
- when "hover"
22
- # Hover passes the Shoes widget as the block param
23
- @unsub_id = bind_self_event("hover") do
24
- @callback&.call(self)
25
- end
26
- when "motion"
27
- # Shoes sends back x, y, mods as the args.
28
- # Shoes3 uses the strings "control" "shift" and
29
- # "control_shift" as the mods arg.
30
- @unsub_id = bind_self_event("motion") do |x, y, ctrl_key, shift_key, **_kwargs|
31
- mods = [ctrl_key ? "control" : nil, shift_key ? "shift" : nil].compact.join("_")
32
- @callback&.call(x, y, mods)
33
- end
34
- when "click"
35
- # Click has block params button, left, top
36
- # button is the button number, left and top are coords
37
- @unsub_id = bind_self_event("click") do |button, x, y, **_kwargs|
38
- @callback&.call(button, x, y)
39
- end
40
- else
41
- raise "Unknown Shoes API call #{shoes_api_name.inspect} passed to SubscriptionItem!"
42
- end
43
-
44
- @unsub_id = bind_self_event(shoes_api_name) do |*args|
45
- @callback&.call(*args)
46
- end
47
-
48
- # This won't create a visible display widget, but will turn into
49
- # an invisible widget and a stream of events.
50
- create_display_widget
51
- end
52
-
53
- def destroy
54
- # TODO: we need a better way to do this automatically. See https://github.com/scarpe-team/scarpe/issues/291
55
- unsub_shoes_event(@unsub_id) if @unsub_id
56
- @unsub_id = nil
57
-
58
- super
59
- end
60
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Shoes::TextWidget
4
-
5
- module Shoes
6
- class TextWidget < Shoes::Widget
7
- class << self
8
- # rubocop:disable Lint/MissingSuper
9
- def inherited(subclass)
10
- Shoes::Widget.widget_classes ||= []
11
- Shoes::Widget.widget_classes << subclass
12
- end
13
- # rubocop:enable Lint/MissingSuper
14
- end
15
- end
16
-
17
- class << self
18
- def default_text_widget_with(element)
19
- class_name = element.capitalize
20
-
21
- widget_class = Class.new(Shoes::TextWidget) do
22
- # Can we just change content to text to match the Shoes API?
23
- display_property :content
24
-
25
- def initialize(content)
26
- @content = content
27
-
28
- super
29
-
30
- create_display_widget
31
- end
32
-
33
- def text
34
- self.content
35
- end
36
-
37
- def text=(new_text)
38
- self.content = new_text
39
- end
40
- end
41
- Shoes.const_set class_name, widget_class
42
- widget_class.class_eval do
43
- display_property :content
44
- end
45
- end
46
- end
47
- end
48
-
49
- Shoes.default_text_widget_with(:code)
50
- Shoes.default_text_widget_with(:em)
51
- Shoes.default_text_widget_with(:strong)
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Video < Shoes::Widget
5
- display_properties :url
6
-
7
- def initialize(url)
8
- @url = url
9
- super
10
- create_display_widget
11
- end
12
-
13
- # other methods
14
- end
15
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "shoes/widgets/slot"
4
- require "shoes/widgets/stack"
5
- require "shoes/widgets/flow"
6
- require "shoes/widgets/document_root"
7
-
8
- require "shoes/widgets/text_widget"
9
-
10
- require "shoes/widgets/font"
11
- require "shoes/widgets/subscription_item"
12
-
13
- require "shoes/widgets/arc"
14
- require "shoes/widgets/line"
15
- require "shoes/widgets/shape"
16
- require "shoes/widgets/star"
17
-
18
- require "shoes/widgets/alert"
19
- require "shoes/widgets/button"
20
- require "shoes/widgets/check"
21
- require "shoes/widgets/edit_box"
22
- require "shoes/widgets/edit_line"
23
- require "shoes/widgets/image"
24
- require "shoes/widgets/link"
25
- require "shoes/widgets/list_box"
26
- require "shoes/widgets/para"
27
- require "shoes/widgets/radio"
28
- require "shoes/widgets/span"
29
- require "shoes/widgets/video"
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tempfile"
4
- require "json"
5
- require "fileutils"
6
-
7
- module Scarpe::Test; end
8
-
9
- # We need a separate assertion system for the kind of Scarpe
10
- # testing where we start a subprocess, perform the assertion
11
- # logic in the subprocess, and then run Minitest in the parent.
12
- # It's an unusual setup.
13
- module Scarpe::Test::EventedAssertions
14
- # Assert that `text` includes `subtext`.
15
- #
16
- # @param text [String] the longer text
17
- # @param subtext [String] the text that is asserted to be included
18
- # @param msg [String,nil] if supplied, the failure message for the assertion
19
- # @return [void]
20
- def assert_include(text, subtext, msg = nil)
21
- msg ||= "Expected #{text.inspect} to include #{subtext.inspect}"
22
- assert text.include?(subtext), msg
23
- end
24
-
25
- # Assert that `text` does not include `subtext`.
26
- #
27
- # @param text [String] the longer text
28
- # @param subtext [String] the text that is asserted to not be included
29
- # @param msg [String,nil] if supplied, the failure message for the assertion
30
- # @return [void]
31
- def assert_not_include(text, subtext, msg = nil)
32
- msg ||= "Expected #{text.inspect} not to include #{subtext.inspect}"
33
- assert !text.include?(subtext), msg
34
- end
35
-
36
- # Assert that `actual_html` is the same as `expected_tag` with `opts`.
37
- # This uses Scarpe's HTML tag-based renderer to render the tag and options
38
- # into text, and valides that the text is the same.
39
- #
40
- # @see Scarpe::HTML.render
41
- #
42
- # @param actual_html [String] the html to compare to
43
- # @param expected_tag [String,Symbol] the HTML tag, used to send a method call
44
- # @param opts keyword options passed to the tag method call
45
- # @yield block passed to the tag method call.
46
- # @return [void]
47
- def assert_html(actual_html, expected_tag, **opts, &block)
48
- expected_html = Scarpe::HTML.render do |h|
49
- h.public_send(expected_tag, opts, &block)
50
- end
51
-
52
- assert_equal expected_html, actual_html
53
- end
54
-
55
- # This does a final return of results. If it gets called
56
- # multiple times, the test fails because that's not allowed.
57
- #
58
- # @param result_bool [Boolean] true if the results are success, false if failure
59
- # @param msg [String] the message included with the results
60
- # @param data [Hash] any additional data to pass with the results
61
- # @return void
62
- def return_results(result_bool, msg, data = {})
63
- result_file = ENV["SCARPE_TEST_RESULTS"] || "./scarpe_results.txt"
64
-
65
- result_structs = [result_bool, msg, data.merge(test_metadata)]
66
- if File.exist?(result_file)
67
- results_returned = JSON.parse File.read(result_file)
68
- end
69
-
70
- # Multiple different sets of results is bad, even if both are passing.
71
- if results_returned && results_returned[0..1] != result_structs[0..1]
72
- # Just raising here doesn't reliably fail the test.
73
- # See: https://github.com/scarpe-team/scarpe/issues/212
74
- Shoes::Log.logger("Test Results").error("Writing multi-result failure file to #{result_file.inspect}!")
75
-
76
- new_res_data = { first_result: results_returned, second_result: result_structs }.merge(test_metadata)
77
- bad_result = [false, "Returned two sets of results!", new_res_data]
78
- File.write(result_file, JSON.pretty_generate(bad_result))
79
-
80
- return
81
- elsif results_returned
82
- Shoes::Log.logger("Test Results").warn "Returning identical results twice: #{results_returned.inspect}"
83
- end
84
-
85
- Shoes::Log.logger("Test Results").debug("Writing results file #{result_file.inspect} to disk!")
86
- File.write(result_file, JSON.pretty_generate(result_structs))
87
- end
88
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Scarpe
4
- class WebviewAlert < WebviewWidget
5
- def initialize(properties)
6
- super
7
-
8
- bind("click") do
9
- send_self_event(event_name: "click")
10
- end
11
- end
12
-
13
- def element
14
- onclick = handler_js_code("click")
15
-
16
- HTML.render do |h|
17
- h.div(id: html_id, style: overlay_style) do
18
- h.div(style: modal_style) do
19
- h.div(style: text_style) { @text }
20
- h.button(style: button_style, onclick: onclick) { "OK" }
21
- end
22
- end
23
- end
24
- end
25
-
26
- protected
27
-
28
- # If the whole widget is hidden, the parent style adds display:none
29
- def overlay_style
30
- {
31
- position: "fixed",
32
- top: "0",
33
- left: "0",
34
- width: "100%",
35
- height: "100%",
36
- overflow: "auto",
37
- "z-index": "1",
38
- background: "rgba(0,0,0,0.4)",
39
- display: "flex",
40
- "align-items": "center",
41
- "justify-content": "center",
42
- }.merge(style)
43
- end
44
-
45
- def modal_style
46
- {
47
- "min-width": "200px",
48
- "min-height": "50px",
49
- padding: "10px",
50
- display: "flex",
51
- background: "#fefefe",
52
- "flex-direction": "column",
53
- "justify-content": "space-between",
54
- "border-radius": "9px",
55
- }
56
- end
57
-
58
- def text_style
59
- {}
60
- end
61
-
62
- def button_style
63
- {}
64
- end
65
- end
66
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "scarpe/components/base64"
4
-
5
- class Scarpe
6
- module WebviewBackground
7
- include Components::Base64
8
-
9
- def style
10
- styles = (super if defined?(super)) || {}
11
- return styles unless @background_color
12
-
13
- color = case @background_color
14
- when Array
15
- "rgba(#{@background_color.join(", ")})"
16
- when Range
17
- "linear-gradient(45deg, #{@background_color.first}, #{@background_color.last})"
18
- when ->(value) { File.exist?(value) }
19
- "url(data:image/png;base64,#{encode_file_to_base64(@background_color)})"
20
- else
21
- @background_color
22
- end
23
-
24
- styles.merge(background: color)
25
- end
26
- end
27
- end
@@ -1,238 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # The ControlInterface doesn't, by default, include much of a test framework.
4
- # But writing a test framework in heredocs in test_helper.rb seems bad.
5
- # So we write a test framework here, but don't include it by default.
6
- # A running shoes app won't normally include it, but unit tests will.
7
-
8
- require "json"
9
-
10
- require "scarpe/components/unit_test_helpers"
11
- require "scarpe/evented_assertions"
12
-
13
- class Scarpe
14
- DEFAULT_ASSERTION_TIMEOUT = 1.0
15
-
16
- class ControlInterface
17
- include Scarpe::Test::EventedAssertions
18
- include Scarpe::Test::Helpers
19
-
20
- def timed_out?
21
- @did_time_out
22
- end
23
-
24
- def die_after(time)
25
- t_start = Time.now
26
- @die_after = [t_start, time]
27
-
28
- wrangler.periodic_code("scarpeTestTimeout") do |*_args|
29
- t_delta = (Time.now - t_start).to_f
30
- if t_delta > time
31
- @did_time_out = true
32
- @log.warn("die_after - timed out after #{t_delta.inspect} (threshold: #{time.inspect})")
33
- return_results(false, "Timed out!")
34
- app.destroy
35
- end
36
- end
37
- end
38
-
39
- # This is returned alongside the actual results automatically
40
- def test_metadata
41
- data = {}
42
- if @die_after
43
- t_delta = (Time.now - @die_after[0]).to_f
44
- data["die_after"] = {
45
- t_start: @die_after[0].to_s,
46
- threshold: @die_after[1],
47
- passed: t_delta,
48
- }
49
- end
50
- data
51
- end
52
-
53
- # Need to be able to query widgets in test code
54
-
55
- def all_wv_widgets
56
- known = [doc_root]
57
- to_check = [doc_root]
58
-
59
- until to_check.empty?
60
- next_layer = to_check.flat_map(&:children)
61
- known += next_layer
62
- to_check = next_layer
63
- end
64
-
65
- # I don't *think* we'll ever have widget trees that merge back together, but just in case we'll de-dup
66
- known.uniq
67
- end
68
-
69
- # Shoes doesn't name widgets. We aren't guaranteed that the Shoes widgets are even in the same
70
- # process, since we have the Relay display service for Webview. So mostly we can look by
71
- # display service class.
72
- def find_wv_widgets(*specifiers)
73
- widgets = all_wv_widgets
74
-
75
- specifiers.each do |spec|
76
- if spec.is_a?(Class)
77
- widgets.select! { |w| spec === w }
78
- else
79
- raise "I don't know how to search for widgets by #{spec.inspect}!"
80
- end
81
- end
82
-
83
- widgets
84
- end
85
-
86
- # We want an assertions library, but one that runs inside the spawned
87
- # Webview sub-process.
88
-
89
- # Note that we do *not* extract this assertions library to use elsewhere
90
- # because it's very focused on evented assertions that start and stop
91
- # over a period of time. Instantaneous procedural asserts don't want to
92
- # use this API.
93
-
94
- def return_when_assertions_done
95
- assertions_may_exist
96
-
97
- wrangler.periodic_code("scarpeReturnWhenAssertionsDone") do |*_args|
98
- if @assertions_pending.empty?
99
- success = @assertions_failed.empty?
100
- return_results success, "Assertions #{success ? "succeeded" : "failed"}", assertion_data_as_a_struct
101
- app.destroy
102
- end
103
- end
104
- end
105
-
106
- def assertions_may_exist
107
- @assertions_pending ||= {}
108
- @assertions_failed ||= {}
109
- @assertions_passed ||= 0
110
- @assertion_counter ||= 0
111
- end
112
-
113
- def start_assertion(code)
114
- assertions_may_exist
115
-
116
- this_assertion = @assertion_counter
117
- @assertion_counter += 1
118
-
119
- @assertions_pending[this_assertion] = {
120
- id: this_assertion,
121
- code: code,
122
- }
123
-
124
- this_assertion
125
- end
126
-
127
- def pass_assertion(id)
128
- @assertions_pending.delete(id)
129
- @assertions_passed += 1
130
- end
131
-
132
- def fail_assertion(id, fail_message)
133
- item = @assertions_pending.delete(id)
134
- item[:fail_message] = fail_message
135
- @assertions_failed[id] = item
136
- end
137
-
138
- def assertions_pending?
139
- !@assertions_pending.empty?
140
- end
141
-
142
- def assertion_data_as_a_struct
143
- {
144
- still_pending: @assertions_pending.size,
145
- succeeded: @assertions_passed,
146
- failed: @assertions_failed.size,
147
- failures: @assertions_failed.values.map { |item| [item[:code], item[:failure_reason]] },
148
- }
149
- end
150
-
151
- # Create a promise to do a JS assertion, normally after other ops have finished.
152
- def assert_js(js_code, wait_for: [], timeout: DEFAULT_ASSERTION_TIMEOUT)
153
- id = start_assertion(js_code)
154
-
155
- # this isn't a TestPromise, so it doesn't have the additional DSL entries
156
- promise = wrangler.eval_js_async(js_code, wait_for: wait_for, timeout: timeout)
157
- promise.on_rejected do
158
- fail_assertion(id, "JS Eval failed: #{promise.reason.inspect}")
159
- end
160
- promise.on_fulfilled do
161
- ret_val = promise.returned_value
162
- if ret_val
163
- pass_assertion(id)
164
- else
165
- fail_assertion(id, "Expected true JS value: #{ret_val.inspect}")
166
- end
167
- end
168
-
169
- # So we wrap it in a no-op TestPromise, to get the DSL entries.
170
- TestPromise.new(iface: self, wait_for: [promise]).to_execute {}
171
- end
172
-
173
- def assert(value, msg = nil)
174
- id = start_assertion("#{caller[0]}: #{msg || "Value should be true!"}")
175
-
176
- if value
177
- pass_assertion(id)
178
- else
179
- fail_assertion(id, "Expected true Ruby value: #{value.inspect}")
180
- end
181
- end
182
-
183
- def assert_equal(val1, val2, msg = nil)
184
- assert val1 == val2, (msg || "Expected #{val2.inspect} to equal #{val1.inspect}!")
185
- end
186
-
187
- # How do we signal an error?
188
- def with_js_value(js_code, wait_for: [], timeout: DEFAULT_ASSERTION_TIMEOUT, &block)
189
- raise "Must give a block to with_js_value!" unless block
190
-
191
- js_promise = wrangler.eval_js_async(js_code, wait_for: wait_for, timeout: timeout)
192
- ruby_promise = TestPromise.new(iface: self, wait_for: [js_promise])
193
- ruby_promise.to_execute(&block)
194
- ruby_promise
195
- end
196
-
197
- def with_js_dom_html(wait_for: [], timeout: DEFAULT_ASSERTION_TIMEOUT, &block)
198
- with_js_value("document.getElementById('wrapper-wvroot').innerHTML", wait_for: wait_for, timeout: timeout, &block)
199
- end
200
-
201
- def fully_updated(wait_for: [])
202
- wrangler.promise_dom_fully_updated
203
- end
204
- end
205
-
206
- # A {Scarpe::Promise} but with helper functions for Webview testing.
207
- class TestPromise < Scarpe::Promise
208
- def initialize(iface:, state: nil, wait_for: [], &scheduler)
209
- @iface = iface
210
- super(state: state, parents: wait_for, &scheduler)
211
- end
212
-
213
- def inspect
214
- "<#TestPromise::#{object_id} state=#{state.inspect} parents=#{parents.inspect} value=#{returned_value.inspect} reason=#{reason.inspect}>"
215
- end
216
-
217
- # This method expects to wait for the parent TestPromise and then run a block of Ruby that returns
218
- # another promise. This is useful for wrapping Promises like those from replace() that don't have
219
- # the test DSL built in. The block will execute when this outer promise is scheduled -- so we don't do
220
- # a replace() too early, for instance. And then the outer promise will fulfill when the inner one does.
221
- def then_ruby_promise(wait_for: [], &block)
222
- ruby_wrapper_promise = TestPromise.new iface: @iface, wait_for: ([self] + wait_for)
223
-
224
- ruby_wrapper_promise.on_scheduled do
225
- inner_ruby_promise = block.call
226
- inner_ruby_promise.on_fulfilled { ruby_wrapper_promise.fulfilled!(inner_ruby_promise.returned_value) }
227
- end
228
- end
229
-
230
- def then_with_js_value(js_code, wait_for: [], timeout: DEFAULT_ASSERTION_TIMEOUT, &block)
231
- @iface.with_js_value(js_code, wait_for: (wait_for + [self]), timeout:, &block)
232
- end
233
-
234
- def then_with_js_dom_html(wait_for: [], timeout: DEFAULT_ASSERTION_TIMEOUT, &block)
235
- @iface.with_js_dom_html(wait_for: (wait_for + [self]), timeout:, &block)
236
- end
237
- end
238
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Scarpe
4
- class Dimensions
5
- class << self
6
- def length(value)
7
- case value
8
- when Integer
9
- if value < 0
10
- "calc(100% - #{value.abs}px)"
11
- else
12
- "#{value}px"
13
- end
14
- when Float
15
- "#{value * 100}%"
16
- else
17
- value
18
- end
19
- end
20
- end
21
- end
22
- end