glimmer 0.1.5.470 → 0.1.8.470
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/.coveralls.yml +1 -0
- data/.rspec +2 -0
- data/Gemfile +2 -0
- data/README.markdown +7 -2
- data/Rakefile +7 -8
- data/TODO.md +1 -1
- data/VERSION +1 -1
- data/bin/girb +3 -0
- data/bin/girb_runner.rb +5 -0
- data/glimmer.gemspec +29 -19
- data/lib/glimmer_application.rb +1 -2
- data/lib/shine.rb +23 -21
- data/lib/xml_command_handlers/models/node.rb +11 -11
- data/lib/xml_command_handlers/models/xml_visitor.rb +12 -12
- data/samples/tictactoe/tic_tac_toe.rb +11 -11
- data/spec/lib/command_handlers/models/observable_model_spec.rb +22 -0
- data/spec/lib/command_handlers/models/r_widget_spec.rb +52 -0
- data/{test/glimmer_combo_data_binding_test.rb → spec/lib/glimmer__combo_data_binding__spec.rb} +48 -49
- data/spec/lib/glimmer__constant__spec.rb +30 -0
- data/{test/glimmer_data_binding_test.rb → spec/lib/glimmer__data_binding__spec.rb} +95 -94
- data/spec/lib/glimmer__list_data_binding__spec.rb +224 -0
- data/{test/glimmer_listeners_test.rb → spec/lib/glimmer__listeners__spec.rb} +18 -19
- data/spec/lib/glimmer__shine_data_binding__spec.rb +89 -0
- data/spec/lib/glimmer__tab_item__spec.rb +55 -0
- data/spec/lib/glimmer__table_data_binding__spec.rb +121 -0
- data/spec/lib/glimmer_spec.rb +251 -0
- data/spec/lib/xml/glimmer_xml_spec.rb +154 -0
- data/spec/samples/contactmanager/contact_manager_presenter_spec.rb +81 -0
- data/spec/samples/tictactoe/tic_tac_toe_spec.rb +263 -0
- data/spec/spec_helper.rb +123 -0
- metadata +50 -17
- data/test/glimmer_constant_test.rb +0 -30
- data/test/glimmer_list_data_binding_test.rb +0 -223
- data/test/glimmer_shine_data_binding_test.rb +0 -89
- data/test/glimmer_tab_item_test.rb +0 -61
- data/test/glimmer_table_data_binding_test.rb +0 -122
- data/test/glimmer_test.rb +0 -237
- data/test/helper.rb +0 -24
- data/test/observable_model_test.rb +0 -25
- data/test/r_widget_test.rb +0 -52
- data/test/samples/contactmanager/contact_manager_presenter_test.rb +0 -81
- data/test/samples/tictactoe/tic_tac_toe_test.rb +0 -262
- data/test/xml/glimmer_xml_test.rb +0 -163
@@ -1,163 +0,0 @@
|
|
1
|
-
require_relative "../helper"
|
2
|
-
require_relative "../../lib/parent"
|
3
|
-
|
4
|
-
class GlimmerXmlTest < Test::Unit::TestCase
|
5
|
-
include Glimmer
|
6
|
-
|
7
|
-
def setup
|
8
|
-
dsl :xml
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_single_html_tag
|
12
|
-
@target = html
|
13
|
-
|
14
|
-
assert_not_nil @target
|
15
|
-
assert_equal "<html/>", @target.to_xml
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_single_document_tag_upper_case
|
19
|
-
@target = tag(:_name => "DOCUMENT")
|
20
|
-
|
21
|
-
assert_not_nil @target
|
22
|
-
assert_equal "<DOCUMENT/>", @target.to_xml
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_open_and_closed_html_tag
|
26
|
-
@target = html {}
|
27
|
-
|
28
|
-
assert_not_nil @target
|
29
|
-
assert_equal "<html></html>", @target.to_xml
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_open_and_closed_html_tag_with_contents
|
33
|
-
@target = html { "This is an HTML Document" }
|
34
|
-
|
35
|
-
assert_not_nil @target
|
36
|
-
assert_equal "<html>This is an HTML Document</html>", @target.to_xml
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_open_and_closed_html_tag_with_contents
|
40
|
-
@target = html { "This is an HTML Document" }
|
41
|
-
|
42
|
-
assert_not_nil @target
|
43
|
-
assert_equal "<html>This is an HTML Document</html>", @target.to_xml
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_open_and_closed_html_tag_with_attributes
|
47
|
-
@target = html(:id => "thesis", :class => "document") {
|
48
|
-
}
|
49
|
-
|
50
|
-
assert_not_nil @target
|
51
|
-
assert_equal '<html id="thesis" class="document"></html>', @target.to_xml
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_open_and_closed_html_tag_with_attributes_and_nested_body_with_attributes
|
55
|
-
@target = html(:id => "thesis", :class => "document") {
|
56
|
-
body(:id => "main") {
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
assert_not_nil @target
|
61
|
-
assert_equal '<html id="thesis" class="document"><body id="main"></body></html>', @target.to_xml
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_tag_with_contents_before_and_after_nested_tag
|
65
|
-
@target = html(:id => "thesis", :class => "document") {
|
66
|
-
text "Before body"
|
67
|
-
body(:id => "main") {
|
68
|
-
}
|
69
|
-
text "When a string is the last part of the tag contents, text prefix is optional"
|
70
|
-
}
|
71
|
-
|
72
|
-
assert_not_nil @target
|
73
|
-
assert_equal '<html id="thesis" class="document">Before body<body id="main"></body>When a string is the last part of the tag contents, text prefix is optional</html>', @target.to_xml
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_different_name_spaced_tags
|
77
|
-
@target = w3c.html(:id => "thesis", :class => "document") {
|
78
|
-
document.body(:id => "main") {
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
assert_not_nil @target
|
83
|
-
assert_equal '<w3c:html id="thesis" class="document"><document:body id="main"></document:body></w3c:html>', @target.to_xml
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_different_name_spaced_attributes_and_tags
|
87
|
-
@target = w3c.html(w3c.id => "thesis", :class => "document") {
|
88
|
-
document.body(document.id => "main") {
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
assert_not_nil @target
|
93
|
-
assert_equal '<w3c:html w3c:id="thesis" class="document"><document:body document:id="main"></document:body></w3c:html>', @target.to_xml
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_name_space_context
|
97
|
-
@target = name_space(:w3c) {
|
98
|
-
html(:id => "thesis", :class => "document") {
|
99
|
-
body(:id => "main") {
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
assert_not_nil @target
|
105
|
-
assert_equal '<w3c:html id="thesis" class="document"><w3c:body id="main"></w3c:body></w3c:html>', @target.to_xml
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_two_name_space_contexts
|
109
|
-
@target = name_space(:w3c) {
|
110
|
-
html(:id => "thesis", :class => "document") {
|
111
|
-
name_space(:document) {
|
112
|
-
sectionDivider(:id => "main") {
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
assert_not_nil @target
|
119
|
-
assert_equal '<w3c:html id="thesis" class="document"><document:sectionDivider id="main"></document:sectionDivider></w3c:html>', @target.to_xml
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_two_name_space_contexts_including_contents
|
123
|
-
@target = name_space(:w3c) {
|
124
|
-
html(:id => "thesis", :class => "document") {
|
125
|
-
text "before section divider"
|
126
|
-
name_space(:document) {
|
127
|
-
sectionDivider(:id => "main") {
|
128
|
-
"section divider"
|
129
|
-
}
|
130
|
-
}
|
131
|
-
text "after section divider"
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
assert_not_nil @target
|
136
|
-
assert_equal '<w3c:html id="thesis" class="document">before section divider<document:sectionDivider id="main">section divider</document:sectionDivider>after section divider</w3c:html>', @target.to_xml
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_mixed_contents_custom_syntax
|
140
|
-
@target = html{"before section divider#strong{section divider}after section divider"}
|
141
|
-
|
142
|
-
assert_not_nil @target
|
143
|
-
assert_equal '<html>before section divider<strong>section divider</strong>after section divider</html>', @target.to_xml
|
144
|
-
end
|
145
|
-
|
146
|
-
#TODO handle special characters such as #, {, }, and .
|
147
|
-
#TODO CDATA support
|
148
|
-
#TODO encode special characters
|
149
|
-
|
150
|
-
def test_html_alternative_syntax_for_id_and_class_attributes
|
151
|
-
@target = html_thesis_document {
|
152
|
-
body_main {
|
153
|
-
h1__title
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
assert_not_nil @target
|
158
|
-
assert_equal '<html id="thesis" class="document"><body id="main"><h1 class="title" /></body></html>', @target.to_xml
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
162
|
-
|
163
|
-
|