opal-browser 0.3.3 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +28 -17
  3. data/.github/workflows/pages.yml +21 -0
  4. data/.gitignore +1 -0
  5. data/CHANGELOG.md +10 -0
  6. data/Gemfile +15 -5
  7. data/Rakefile +32 -9
  8. data/bin/rake +7 -0
  9. data/bin/setup +8 -0
  10. data/config.ru +19 -12
  11. data/opal/browser/animation_frame.rb +1 -0
  12. data/opal/browser/audio/node.rb +1 -0
  13. data/opal/browser/audio/param_schedule.rb +1 -0
  14. data/opal/browser/audio.rb +2 -1
  15. data/opal/browser/blob.rb +1 -0
  16. data/opal/browser/canvas/data.rb +1 -0
  17. data/opal/browser/canvas/gradient.rb +1 -0
  18. data/opal/browser/canvas/style.rb +1 -0
  19. data/opal/browser/canvas/text.rb +1 -0
  20. data/opal/browser/canvas.rb +1 -0
  21. data/opal/browser/console.rb +1 -0
  22. data/opal/browser/cookies.rb +1 -0
  23. data/opal/browser/crypto.rb +1 -0
  24. data/opal/browser/css/declaration.rb +1 -0
  25. data/opal/browser/css/rule/style.rb +1 -0
  26. data/opal/browser/css/rule.rb +1 -0
  27. data/opal/browser/css/style_sheet.rb +1 -0
  28. data/opal/browser/database/sql.rb +1 -0
  29. data/opal/browser/delay.rb +1 -0
  30. data/opal/browser/dom/builder.rb +1 -0
  31. data/opal/browser/dom/character_data.rb +1 -0
  32. data/opal/browser/dom/document.rb +1 -0
  33. data/opal/browser/dom/document_fragment.rb +1 -0
  34. data/opal/browser/dom/document_or_shadow_root.rb +1 -0
  35. data/opal/browser/dom/element/attributes.rb +2 -0
  36. data/opal/browser/dom/element/button.rb +2 -0
  37. data/opal/browser/dom/element/custom.rb +2 -1
  38. data/opal/browser/dom/element/data.rb +2 -0
  39. data/opal/browser/dom/element/editable.rb +2 -0
  40. data/opal/browser/dom/element/form.rb +25 -1
  41. data/opal/browser/dom/element/iframe.rb +2 -0
  42. data/opal/browser/dom/element/image.rb +6 -15
  43. data/opal/browser/dom/element/input.rb +7 -19
  44. data/opal/browser/dom/element/media.rb +5 -3
  45. data/opal/browser/dom/element/offset.rb +2 -0
  46. data/opal/browser/dom/element/scroll.rb +2 -0
  47. data/opal/browser/dom/element/select.rb +4 -7
  48. data/opal/browser/dom/element/size.rb +6 -12
  49. data/opal/browser/dom/element/template.rb +2 -0
  50. data/opal/browser/dom/element/textarea.rb +3 -3
  51. data/opal/browser/dom/element.rb +4 -0
  52. data/opal/browser/dom/mutation_observer.rb +1 -0
  53. data/opal/browser/dom/node.rb +1 -0
  54. data/opal/browser/dom/node_set.rb +1 -0
  55. data/opal/browser/dom/text.rb +1 -0
  56. data/opal/browser/dom.rb +1 -0
  57. data/opal/browser/effects.rb +1 -0
  58. data/opal/browser/event/animation.rb +5 -7
  59. data/opal/browser/event/audio_processing.rb +5 -11
  60. data/opal/browser/event/base.rb +4 -6
  61. data/opal/browser/event/before_unload.rb +2 -0
  62. data/opal/browser/event/clipboard.rb +4 -7
  63. data/opal/browser/event/close.rb +4 -7
  64. data/opal/browser/event/composition.rb +4 -7
  65. data/opal/browser/event/custom.rb +5 -3
  66. data/opal/browser/event/data_transfer.rb +3 -1
  67. data/opal/browser/event/device_light.rb +3 -3
  68. data/opal/browser/event/device_motion.rb +6 -15
  69. data/opal/browser/event/device_orientation.rb +6 -15
  70. data/opal/browser/event/device_proximity.rb +5 -11
  71. data/opal/browser/event/drag.rb +6 -14
  72. data/opal/browser/event/focus.rb +4 -7
  73. data/opal/browser/event/gamepad.rb +3 -1
  74. data/opal/browser/event/hash_change.rb +4 -7
  75. data/opal/browser/event/keyboard.rb +2 -0
  76. data/opal/browser/event/message.rb +5 -11
  77. data/opal/browser/event/mouse.rb +20 -65
  78. data/opal/browser/event/page_transition.rb +3 -3
  79. data/opal/browser/event/pop_state.rb +3 -1
  80. data/opal/browser/event/progress.rb +5 -11
  81. data/opal/browser/event/sensor.rb +2 -0
  82. data/opal/browser/event/storage.rb +7 -19
  83. data/opal/browser/event/touch.rb +2 -0
  84. data/opal/browser/event/ui.rb +4 -7
  85. data/opal/browser/event/wheel.rb +5 -11
  86. data/opal/browser/event.rb +1 -0
  87. data/opal/browser/event_source.rb +1 -0
  88. data/opal/browser/form_data.rb +1 -0
  89. data/opal/browser/history.rb +1 -0
  90. data/opal/browser/http/binary.rb +1 -0
  91. data/opal/browser/http/request.rb +1 -0
  92. data/opal/browser/http/response.rb +1 -0
  93. data/opal/browser/immediate.rb +1 -0
  94. data/opal/browser/interval.rb +1 -0
  95. data/opal/browser/location.rb +1 -0
  96. data/opal/browser/navigator.rb +1 -0
  97. data/opal/browser/polyfill/visual_viewport.rb +1 -0
  98. data/opal/browser/screen.rb +1 -0
  99. data/opal/browser/socket.rb +1 -0
  100. data/opal/browser/storage.rb +1 -0
  101. data/opal/browser/support.rb +22 -33
  102. data/opal/browser/utils.rb +1 -0
  103. data/opal/browser/version.rb +1 -1
  104. data/opal/browser/visual_viewport.rb +1 -0
  105. data/opal/browser/window/size.rb +1 -0
  106. data/opal/browser/window/view.rb +1 -0
  107. data/opal/browser/window.rb +1 -0
  108. data/opal-browser.gemspec +23 -18
  109. data/spec/browser_runner.rb.erb +14 -0
  110. data/spec/browser_runner_compat.rb +29 -0
  111. data/{index.html.erb → spec/browser_runner_index.html.erb} +1 -5
  112. data/spec/database/sql_spec.rb +1 -1
  113. data/spec/event_spec.rb +43 -0
  114. data/spec/immediate_spec.rb +1 -1
  115. data/spec/runner.rb +3 -3
  116. data/spec/spec_helper_promise.rb.erb +13 -5
  117. metadata +206 -34
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Mouse < UI
@@ -13,82 +15,51 @@ class Mouse < UI
13
15
  class Client
14
16
  include Native::Wrapper
15
17
 
16
- def x=(value)
17
- `#@native.clientX = #{value}`
18
- end
19
-
20
- def y=(value)
21
- `#@native.clientY = #{value}`
22
- end
18
+ alias_native :x=, :clientX=
19
+ alias_native :y=, :clientY=
23
20
  end
24
21
 
25
22
  class Layer
26
23
  include Native::Wrapper
27
24
 
28
- def x=(value)
29
- `#@native.layerX = #{value}`
30
- end
31
-
32
- def y=(value)
33
- `#@native.layerY = #{value}`
34
- end
25
+ alias_native :x=, :layerX=
26
+ alias_native :y=, :layerY=
35
27
  end
36
28
 
37
29
  class Offset
38
30
  include Native::Wrapper
39
31
 
40
- def x=(value)
41
- `#@native.offsetX = #{value}`
42
- end
43
-
44
- def y=(value)
45
- `#@native.offsetY= #{value}`
46
- end
32
+ alias_native :x=, :offsetX=
33
+ alias_native :y=, :offsetY=
47
34
  end
48
35
 
49
36
  class Page
50
37
  include Native::Wrapper
51
38
 
52
- def x=(value)
53
- `#@native.pageX = #{value}`
54
- end
55
-
56
- def y=(value)
57
- `#@native.pageY = #{value}`
58
- end
39
+ alias_native :x=, :pageX=
40
+ alias_native :y=, :pageY=
59
41
  end
60
42
 
61
43
  class Screen
62
44
  include Native::Wrapper
63
45
 
64
- def x=(value)
65
- `#@native.screenX = #{value}`
66
- end
67
-
68
- def y=(value)
69
- `#@native.screenY = #{value}`
70
- end
46
+ alias_native :x=, :screenX=
47
+ alias_native :y=, :screenY=
71
48
  end
72
49
 
73
50
  class Ancestor
74
51
  include Native::Wrapper
75
52
 
76
- def x=(value)
77
- `#@native.x = #{value}`
78
- end
79
-
80
- def y=(value)
81
- `#@native.y = #{value}`
82
- end
83
- end
84
-
85
- def x=(value)
86
- `#@native.screenX = #{value}`
53
+ alias_native :x=
54
+ alias_native :y=
87
55
  end
88
56
 
89
- def y=(value)
90
- `#@native.screenY = #{value}`
91
- end
57
+ alias_native :x=, :screenX=
58
+ alias_native :y=, :screenY=
59
+ alias_native :button=
60
+ alias_native :related=, :relatedTarget=
61
+ alias_native :from=, :fromElement=
62
+ alias_native :to=, :toElement=
92
63
 
93
64
  def alt!
94
65
  `#@native.altKey = true`
@@ -102,10 +73,6 @@ class Mouse < UI
102
73
  `#@native.metaKey = true`
103
74
  end
104
75
 
105
- def button=(value)
106
- `#@native.button = #{value}`
107
- end
108
-
109
76
  def client
110
77
  Client.new(@native)
111
78
  end
@@ -129,18 +96,6 @@ class Mouse < UI
129
96
  def ancestor
130
97
  Ancestor.new(@native)
131
98
  end
132
-
133
- def related=(elem)
134
- `#@native.relatedTarget = #{Native.try_convert(elem)}`
135
- end
136
-
137
- def from=(elem)
138
- `#@native.fromElement = #{Native.try_convert(elem)}`
139
- end
140
-
141
- def to=(elem)
142
- `#@native.toElement = #{Native.try_convert(elem)}`
143
- end
144
99
  end
145
100
 
146
101
  if Browser.supports? 'Event.constructor'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class PageTransition < Event
@@ -8,9 +10,7 @@ class PageTransition < Event
8
10
  end
9
11
 
10
12
  class Definition < Definition
11
- def persisted=(value)
12
- `#@native.persisted = #{value}`
13
- end
13
+ alias_native :persisted=
14
14
  end
15
15
 
16
16
  if Browser.supports? 'Event.PageTransition'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class PopState < Event
@@ -9,7 +11,7 @@ class PopState < Event
9
11
 
10
12
  class Definition < Definition
11
13
  def state=(value)
12
- `#@native.state = #{value}`
14
+ alias_native :state=
13
15
  end
14
16
  end
15
17
 
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Progress < Event
@@ -8,17 +10,9 @@ class Progress < Event
8
10
  end
9
11
 
10
12
  class Definition < Definition
11
- def computable=(value)
12
- `#@native.computableLength = #{value}`
13
- end
14
-
15
- def loaded=(value)
16
- `#@native.loaded = #{value}`
17
- end
18
-
19
- def total=(value)
20
- `#@native.total = #{value}`
21
- end
13
+ alias_native :computable=, :computableLength=
14
+ alias_native :loaded=
15
+ alias_native :total=
22
16
  end
23
17
 
24
18
  if Browser.supports? 'Event.constructor'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Sensor < Event
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Storage < Event
@@ -8,25 +10,11 @@ class Storage < Event
8
10
  end
9
11
 
10
12
  class Definition < Definition
11
- def key=(value)
12
- `#@native.key = #{value}`
13
- end
14
-
15
- def new=(value)
16
- `#@native.newValue = #{value}`
17
- end
18
-
19
- def old=(value)
20
- `#@native.oldValue = #{value}`
21
- end
22
-
23
- def area=(value)
24
- `#@native.storageArea = #{value}`
25
- end
26
-
27
- def url=(value)
28
- `#@native.url = #{value}`
29
- end
13
+ alias_native :key=
14
+ alias_native :new=, :newValue=
15
+ alias_native :old=, :oldValue=
16
+ alias_native :area=, :storageArea=
17
+ alias_native :url=
30
18
  end
31
19
 
32
20
  if Browser.supports? 'Event.constructor'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Touch < Event
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class UI < Event
@@ -6,13 +8,8 @@ class UI < Event
6
8
  end
7
9
 
8
10
  class Definition < Definition
9
- def detail=(value)
10
- `#@native.detail = #{value}`
11
- end
12
-
13
- def view=(value)
14
- `#@native.view = #{value}`
15
- end
11
+ alias_native :detail=
12
+ alias_native :view=
16
13
  end
17
14
 
18
15
  if Browser.supports? 'Event.constructor'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Wheel < UI
@@ -8,17 +10,9 @@ class Wheel < UI
8
10
  end
9
11
 
10
12
  class Definition < Definition
11
- def x=(value)
12
- `#@native.deltaX = #{value}`
13
- end
14
-
15
- def y=(value)
16
- `#@native.deltaY = #{value}`
17
- end
18
-
19
- def z=(value)
20
- `#@native.deltaZ = #{value}`
21
- end
13
+ alias_native :x=, :deltaX=
14
+ alias_native :y=, :deltaY=
15
+ alias_native :z=, :deltaZ=
22
16
 
23
17
  def mode=(value)
24
18
  value = case value
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  require 'browser/event/base'
2
3
 
3
4
  module Browser
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # An {EventSource} allows you to receive events from a server in real-time,
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  class FormData
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  require 'browser/location'
2
3
 
3
4
  module Browser
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser; module HTTP
2
3
 
3
4
  # Represents a binary result from a HTTP response.
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser; module HTTP
2
3
 
3
4
  class Request
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  require 'json'
2
3
 
3
4
  module Browser; module HTTP
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # Class to easily create and dispatch an immediate call.
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # Allows you to create an interval that executes the function every given
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # Allows manipulation of a location, usually from {Window} and {DOM::Document}.
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # Representation of the navigator application.
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  # VisualViewport polyfill (mainly for Firefox browsers) taken from:
2
3
  # https://github.com/WICG/visual-viewport/blob/gh-pages/polyfill/visualViewport.js
3
4
  # Licensed under "W3C 3-clause BSD License".
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # Representation of the screen the window is being rendered on.
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
 
3
4
  # A {Socket} allows the browser and a server to have a bidirectional data
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  require 'json'
2
3
  require 'stringio'
3
4
 
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  # The engine the browser is running on.
2
3
  #
3
4
  # Keep in mind it uses the user agent to know, so it's not reliable in case of
@@ -75,16 +76,14 @@ module Browser
75
76
  when 'Window.send (Asynchronous)'
76
77
  if defined?(`window.postMessage`) && !defined?(`window.importScripts`)
77
78
  %x{
78
- (function() {
79
- var ok = true,
80
- old = window.onmessage;
79
+ var ok = true,
80
+ old = window.onmessage;
81
81
 
82
- window.onmessage = function() { ok = false; };
83
- window.postMessage("", "*")
84
- window.onmessage = old;
82
+ window.onmessage = function() { ok = false; };
83
+ window.postMessage("", "*")
84
+ window.onmessage = old;
85
85
 
86
- return ok;
87
- })()
86
+ return ok;
88
87
  }
89
88
  end
90
89
 
@@ -108,12 +107,10 @@ module Browser
108
107
 
109
108
  when 'Attr.isId'
110
109
  %x{
111
- (function() {
112
- var div = document.createElement('div');
113
- div.setAttribute('id', 'xxxxxxxxxxxxx');
110
+ var div = document.createElement('div');
111
+ div.setAttribute('id', 'xxxxxxxxxxxxx');
114
112
 
115
- return typeof(div.attributes['id'].isId) !== "undefined";
116
- })()
113
+ return typeof(div.attributes['id'].isId) !== "undefined";
117
114
  }
118
115
 
119
116
  when 'Element.addBehavior'
@@ -121,42 +118,34 @@ module Browser
121
118
 
122
119
  when 'Element.className'
123
120
  %x{
124
- (function() {
125
- var div = document.createElement("div");
126
- div.setAttribute('className', 'x');
121
+ var div = document.createElement("div");
122
+ div.setAttribute('className', 'x');
127
123
 
128
- return div.className === 'x';
129
- })()
124
+ return div.className === 'x';
130
125
  }
131
126
 
132
127
  when 'Element.class'
133
128
  %x{
134
- (function() {
135
- var div = document.createElement("div");
136
- div.setAttribute('class', 'x');
129
+ var div = document.createElement("div");
130
+ div.setAttribute('class', 'x');
137
131
 
138
- return div.className === 'x';
139
- })()
132
+ return div.className === 'x';
140
133
  }
141
134
 
142
135
  when 'Element.for'
143
136
  %x{
144
- (function() {
145
- var label = document.createElement("label");
146
- label.setAttribute('for', 'x');
137
+ var label = document.createElement("label");
138
+ label.setAttribute('for', 'x');
147
139
 
148
- return label.htmlFor === 'x';
149
- })()
140
+ return label.htmlFor === 'x';
150
141
  }
151
142
 
152
143
  when 'Element.htmlFor'
153
144
  %x{
154
- (function() {
155
- var label = document.createElement("label");
156
- label.setAttribute('htmlFor', 'x');
145
+ var label = document.createElement("label");
146
+ label.setAttribute('htmlFor', 'x');
157
147
 
158
- return label.htmlFor === 'x';
159
- })()
148
+ return label.htmlFor === 'x';
160
149
  }
161
150
 
162
151
  when 'Element.clientSize'
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser
2
3
  Promise = defined?(PromiseV2) ? PromiseV2 : ::Promise
3
4
 
@@ -1,3 +1,3 @@
1
1
  module Browser
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.5'
3
3
  end
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  # Firefox browsers need either a flag or a polyfill
2
3
  require "browser/polyfill/visual_viewport"
3
4
 
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser; class Window
2
3
 
3
4
  # Allows access and manipulation of the {Window} size.
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  module Browser; class Window
2
3
 
3
4
  class View
@@ -1,3 +1,4 @@
1
+ # backtick_javascript: true
1
2
  require 'browser/window/view'
2
3
  require 'browser/window/size'
3
4
 
data/opal-browser.gemspec CHANGED
@@ -1,21 +1,26 @@
1
- $LOAD_PATH << File.expand_path('../opal', __FILE__)
2
- require 'browser/version'
1
+ require_relative 'opal/browser/version'
3
2
 
4
- Gem::Specification.new {|s|
5
- s.name = 'opal-browser'
6
- s.version = Browser::VERSION
7
- s.author = ['meh.', 'hmdne']
8
- s.email = 'meh@schizofreni.co'
9
- s.homepage = 'http://github.com/opal/opal-browser'
10
- s.platform = Gem::Platform::RUBY
11
- s.summary = 'Browser support for Opal.'
12
- s.license = 'MIT'
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'opal-browser'
5
+ spec.version = Browser::VERSION
6
+ spec.author = ['meh.', 'hmdne']
7
+ spec.email = 'meh@schizofreni.co'
8
+ spec.homepage = 'http://github.com/opal/opal-browser'
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.summary = 'Browser support for Opal.'
11
+ spec.license = 'MIT'
13
12
 
14
- s.files = `git ls-files`.split("\n")
15
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.require_paths = ['lib']
13
+ # Specify which files should be added to the gem when it is released.
14
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
15
+ # Remove symlinks because Windows doesn't always support them.
16
+ files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }.reject(&File.method(:symlink?))
18
17
 
19
- s.add_dependency 'opal', ['>= 1.0', '< 2.0']
20
- s.add_dependency 'paggio', '>= 0.3.0'
21
- }
18
+ spec.files = files.grep(%r{^(test|spec|features)/})
19
+ spec.test_files = files.grep_v(%r{^(test|spec|features)/})
20
+ spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.bindir = 'exe'
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_dependency 'opal', ['>= 1.0', '< 2.0']
25
+ spec.add_dependency 'paggio', '>= 0.3.0'
26
+ end
@@ -0,0 +1,14 @@
1
+ # This file is used by Opal::SimpleServer to basically load all spec files that
2
+ # can be found in the spec/ directory.
3
+
4
+ require 'opal'
5
+ require 'opal-rspec'
6
+
7
+ <%
8
+ $locator.get_opal_spec_requires.each do |s| %>
9
+ require <%= s.split("/spec/").last.inspect %>
10
+ <% end %>
11
+ require 'opal/rspec/spec_opts'
12
+
13
+ ::RSpec::Core::Runner.autorun
14
+ ::Kernel.exit
@@ -0,0 +1,29 @@
1
+ # Compatiblity for Opal < 1.6
2
+
3
+ unless defined? Opal::BuilderProcessors::RubyERBProcessor
4
+ # This handler is for files named ".rb.erb", which ought to
5
+ # first get preprocessed via ERB, then via Opal.
6
+ class Opal::BuilderProcessors::RubyERBProcessor < Opal::BuilderProcessors::RubyProcessor
7
+ handles :"rb.erb"
8
+
9
+ def compiled
10
+ @compiled ||= begin
11
+ @source = ::ERB.new(@source.to_s).result
12
+ module_name = ::Opal::Compiler.module_name(@filename)
13
+
14
+ compiler = compiler_for(@source, file: @filename)
15
+ compiler.compile
16
+ compiler
17
+ end
18
+ end
19
+ end
20
+
21
+ Opal::Builder.processors.sort_by!.with_index do |processor,idx|
22
+ if processor == Opal::BuilderProcessors::RubyERBProcessor
23
+ # Move RubyERBProcessor to the front
24
+ -1
25
+ else
26
+ idx
27
+ end
28
+ end
29
+ end
@@ -14,11 +14,7 @@
14
14
  }
15
15
  </script>
16
16
 
17
- <script src="spec/json2.js"></script>
18
- <script src="spec/sizzle.js"></script>
19
- <script src="spec/wgxpath.install.js"></script>
20
-
21
- <%= javascript_include_tag @server.main %>
17
+ <%= javascript_include_tag 'browser_runner' %>
22
18
  </body>
23
19
  </html>
24
20
 
@@ -54,7 +54,7 @@ describe Browser::Database::SQL do
54
54
 
55
55
  promise = Browser::Promise.new
56
56
  sql.transaction {|t|
57
- expect(t.query('hue')).to be_a(Promise)
57
+ expect(t.query('SELECT 1')).to be_a(Browser::Promise)
58
58
  promise.resolve
59
59
  }
60
60
  promise.for_rspec