www_app 2.0.1 → 2.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4e4320c1e956aa3656ac1515bd6aad999a6d217
4
- data.tar.gz: 0d58947803129279b538b04262bdd411611ae122
3
+ metadata.gz: 0b68703439f6af0d7c3b856f92d150e0f4fa667f
4
+ data.tar.gz: 973a336ae0fa58aef0150adf455bb1b645126726
5
5
  SHA512:
6
- metadata.gz: 2a740396fa45d549999bee46066524d6b4892316a94f97b1c2a18996005152389dd0f16f1a49bed056e2d40295159c6c76fd69d97e8ce528a715090207b091fe
7
- data.tar.gz: 63947c2ed04b804e882ec1bd0965adb406cef28583efcce7648d5c12261002005d24a0824d0171654427a1df1acb356d660d518542d7892c69696b204f62a8d0
6
+ metadata.gz: 820e2f0f4d93552d3d047fc9ea9a63df4301186a2a7778d33043f1caec7ed537ba90c1ac6feffbdc87b50d6c4abb241d174997652b10ba762d8c78ebe3d2ed16
7
+ data.tar.gz: cd154c9fba1e546a97b638f0619fe6d4d8618e621491a201fc854f3e565891f8d631fc3b8592c7c31367ffd52484bf349a89bc7294dac11f6d9a7f1e4f1dd241
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
data/lib/www_app.rb CHANGED
@@ -322,6 +322,10 @@ class WWW_App
322
322
  end
323
323
 
324
324
  def create name, opts = nil
325
+ if @tag && @tag[:closed!]
326
+ go_up
327
+ end
328
+
325
329
  if @tag && @tag[:tag_name] == :_
326
330
 
327
331
  # Ex:
data/lib/www_app/CSS.rb CHANGED
@@ -257,7 +257,7 @@ class WWW_App
257
257
  # _link {
258
258
  #
259
259
  create :group
260
- create :_
260
+ create :_, :closed! => true
261
261
 
262
262
  when ancestor?(:groups) && @tag[:closed]
263
263
  #
@@ -268,7 +268,7 @@ class WWW_App
268
268
  # _link { ... }
269
269
  #
270
270
  create :group
271
- create :_!
271
+ create :_!, :closed! => true
272
272
 
273
273
  when (tag?(:_) || tag?(:_!)) && @tag[:pseudo]
274
274
  # WHEN:
@@ -276,7 +276,7 @@ class WWW_App
276
276
  # _link / _visited
277
277
  tag_name = @tag[:tag_name]
278
278
  go_up
279
- create tag_name
279
+ create tag_name, :closed! => true
280
280
 
281
281
  when @tag[:pseudo] && !@tag[:closed]
282
282
  puts @tag
@@ -295,12 +295,14 @@ class WWW_App
295
295
  def alter_css_property name, *args
296
296
  if !@tag
297
297
  self._
298
+ @tag[:closed!] = true
298
299
  end
299
300
 
300
301
  if tag?(:style)
301
302
  create :group
302
303
  create :_
303
304
  go_up
305
+ @tag[:closed!] = true
304
306
  end
305
307
 
306
308
  @tag[:css] ||= {}
@@ -1,37 +1,37 @@
1
1
 
2
2
  describe ":style block" do
3
3
 
4
- it "does not render empty style classes: div { }" do
4
+ %w[link visited hover].each { |name|
5
+ it "adds :#{name} pseudo-class" do
5
6
  target :style, <<-EOF
6
- div a {
7
+ a:#{name} {
7
8
  color: #fff;
8
9
  }
9
10
  EOF
10
11
 
11
12
  actual do
12
13
  style {
13
- div { a { color '#fff' } }
14
+ a {
15
+ send("_#{name}".to_sym) { color '#fff' }
16
+ }
14
17
  }
15
18
  end
16
- end
19
+ end # === it
20
+ }
17
21
 
18
- %w[link visited hover].each { |name|
19
- it "adds :#{name} pseudo-class" do
22
+ it "does not render empty style classes: div { }" do
20
23
  target :style, <<-EOF
21
- a:#{name} {
24
+ div a {
22
25
  color: #fff;
23
26
  }
24
27
  EOF
25
28
 
26
29
  actual do
27
30
  style {
28
- a {
29
- send("_#{name}".to_sym) { color '#fff' }
30
- }
31
+ div { a { color '#fff' } }
31
32
  }
32
33
  end
33
- end # === it
34
- }
34
+ end
35
35
 
36
36
  it "the default selector is the parent of :style" do
37
37
  target :style, <<-EOF
@@ -57,6 +57,27 @@ describe ":style block" do
57
57
  }
58
58
  end # === it
59
59
 
60
+ it "does not add elements on default selector" do
61
+ target :style, <<-EOF
62
+ body {
63
+ border: 1px solid #000;
64
+ }
65
+
66
+ a:link, a:visited {
67
+ color: #fff;
68
+ }
69
+ EOF
70
+
71
+ actual {
72
+ style {
73
+ border '1px solid #000'
74
+ a._link / a._visited {
75
+ color '#fff'
76
+ }
77
+ }
78
+ }
79
+ end # === it does not add elements on default selector
80
+
60
81
  it "does not add anything to :body" do
61
82
  target :body, <<-EOF
62
83
  <p>empty</p>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: www_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - da99