mumuki-html-runner 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/html_runner.rb +1 -1
- data/lib/test_dom_hook.rb +24 -23
- data/lib/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102f93e38e19ee0595a6d2deb43b9b0d7a66d95f4480dcfd4a5af5521a62f5bd
|
4
|
+
data.tar.gz: 229476d0f83168d0423cb8c91627fdeb418475f1c2e9f86dbcf2bfd7d45bc2d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d0a8f9cd6dedf9bda569c85223e881e776226e1871f9ef7c474e3470944a6966de409431a7013ac7a8ee5cc08b817707344adfff499fed0f37e4fd16687391d
|
7
|
+
data.tar.gz: 87635fd6e2bfc1925f6e3910384dcb1fac651cb3b01702211e791b509109e6a2813451167c3323ee9740c938db2046f9ef501dede94a0f707fb54e0ff53bbbb6
|
data/lib/html_runner.rb
CHANGED
@@ -8,7 +8,7 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
|
|
8
8
|
|
9
9
|
Mumukit.runner_name = 'html'
|
10
10
|
Mumukit.configure do |config|
|
11
|
-
config.docker_image = 'mumuki/mumuki-html-worker:1.
|
11
|
+
config.docker_image = 'mumuki/mumuki-html-worker:1.4'
|
12
12
|
config.content_type = 'html'
|
13
13
|
config.process_expectations_on_empty_content = true
|
14
14
|
config.run_test_hook_on_empty_test = true
|
data/lib/test_dom_hook.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
class Hexp::Node
|
2
|
+
def flat_map_children(&blk)
|
3
|
+
H[tag, attributes, children.flat_map(&blk)]
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
1
7
|
class HtmlTestDomHook < Mumukit::Hook
|
2
8
|
def compile(request)
|
3
9
|
request
|
@@ -28,34 +34,29 @@ class HtmlTestDomHook < Mumukit::Hook
|
|
28
34
|
end
|
29
35
|
|
30
36
|
def comparable_hexp(content, options)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
content = squeeze_inner_whitespaces content unless options['keep_inner_whitespaces']
|
38
|
+
exp = hexp content
|
39
|
+
exp = exp.replace('script') { [] } if options['output_ignore_scripts']
|
40
|
+
exp = exp.replace('style') { [] } if options['output_ignore_styles']
|
41
|
+
exp = remove_outer_whitespaces exp unless options['keep_outer_whitespaces']
|
42
|
+
exp
|
43
|
+
end
|
44
|
+
|
45
|
+
def remove_outer_whitespaces(hexp)
|
46
|
+
hexp.flat_map_children do |node|
|
47
|
+
next remove_outer_whitespaces(node) unless node.text?
|
48
|
+
[node.strip.presence].compact
|
42
49
|
end
|
43
|
-
|
44
|
-
if options['output_ignore_styles']
|
45
|
-
exp = exp.replace('style') { [] }
|
46
|
-
end
|
47
|
-
|
48
|
-
exp.to_html
|
49
50
|
end
|
50
51
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def squeeze_inner_whitespaces(content)
|
53
|
+
%W(\r \n \t)
|
54
|
+
.reduce(content.strip) { |c, it| c.gsub(it, ' ') }
|
55
|
+
.squeeze(' ')
|
55
56
|
end
|
56
57
|
|
57
|
-
def hexp(
|
58
|
-
Hexp.parse("<html>#{
|
58
|
+
def hexp(content)
|
59
|
+
Hexp.parse("<html>#{content}</html>")
|
59
60
|
end
|
60
61
|
|
61
62
|
def render_html(actual)
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-html-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '3.
|
131
|
+
version: '3.8'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '3.
|
138
|
+
version: '3.8'
|
139
139
|
description:
|
140
140
|
email:
|
141
141
|
- franco@mumuki.org
|
@@ -176,8 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
178
|
requirements: []
|
179
|
-
|
180
|
-
rubygems_version: 2.7.8
|
179
|
+
rubygems_version: 3.0.2
|
181
180
|
signing_key:
|
182
181
|
specification_version: 4
|
183
182
|
summary: HTML Runner for Mumuki
|