card 1.16.4 → 1.16.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/db/migrate_core_cards/20150429090551_search_card_context.rb +34 -0
- data/db/migrate_core_cards/20150824135418_update_file_history.rb +10 -5
- data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +10 -0
- data/db/seed/new/card_actions.yml +358 -366
- data/db/seed/new/card_acts.yml +1 -1
- data/db/seed/new/card_changes.yml +1379 -1399
- data/db/seed/new/card_references.yml +1109 -710
- data/db/seed/new/cards.yml +1436 -1454
- data/db/seed/test/fixtures/card_actions.yml +1031 -1039
- data/db/seed/test/fixtures/card_acts.yml +155 -155
- data/db/seed/test/fixtures/card_changes.yml +4148 -4168
- data/db/seed/test/fixtures/card_references.yml +1577 -1178
- data/db/seed/test/fixtures/cards.yml +2259 -2277
- data/db/version_core_cards.txt +1 -1
- data/lib/card.rb +3 -2
- data/lib/card/env.rb +66 -0
- data/lib/card/format.rb +3 -38
- data/lib/card/loader.rb +0 -4
- data/lib/card/location.rb +38 -0
- data/lib/card/set.rb +1 -3
- data/lib/card/success.rb +2 -3
- data/mod/01_core/format/html_format.rb +0 -48
- data/mod/01_core/set/all/collection.rb +9 -7
- data/mod/01_core/set/all/initialize.rb +5 -0
- data/mod/01_core/set/all/location_history.rb +10 -0
- data/mod/01_core/set/all/phases.rb +2 -1
- data/mod/01_core/set/all/rules.rb +0 -2
- data/mod/01_core/set/all/trash.rb +3 -2
- data/mod/01_core/set/all/utils.rb +12 -0
- data/mod/01_core/spec/set/all/permissions_spec.rb +8 -8
- data/mod/01_core/spec/set/all/type_spec.rb +14 -14
- data/mod/01_history/set/all/content_history.rb +7 -3
- data/mod/01_history/set/all/history.rb +3 -3
- data/mod/02_basic_types/set/type/pointer.rb +8 -1
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +39 -0
- data/mod/03_machines/lib/stylesheets/style_cards.scss +12 -2
- data/mod/03_machines/set/right/machine_output.rb +4 -0
- data/mod/03_machines/set/type/css.rb +1 -1
- data/mod/04_settings/spec/set/right/structure_spec.rb +1 -1
- data/mod/05_email/set/all/observer.rb +5 -5
- data/mod/05_email/set/type_plus_right/user/follow.rb +1 -1
- data/mod/05_standard/file/favicon/image-icon.png +0 -0
- data/mod/05_standard/file/favicon/image-large.png +0 -0
- data/mod/05_standard/file/favicon/image-medium.png +0 -0
- data/mod/05_standard/file/favicon/image-original.png +0 -0
- data/mod/05_standard/file/favicon/image-small.png +0 -0
- data/mod/05_standard/lib/carrier_wave/cardmount.rb +8 -2
- data/mod/05_standard/lib/file_uploader.rb +47 -35
- data/mod/05_standard/set/abstract/attachment.rb +87 -35
- data/mod/05_standard/set/all/error.rb +1 -1
- data/mod/05_standard/set/all/links.rb +1 -0
- data/mod/05_standard/set/self/signin.rb +1 -1
- data/mod/05_standard/set/type/file.rb +16 -1
- data/mod/05_standard/set/type/image.rb +2 -0
- data/mod/05_standard/set/type/search_type.rb +2 -2
- data/mod/05_standard/spec/chunk/link_spec.rb +42 -32
- data/mod/05_standard/spec/set/all/links_spec.rb +15 -0
- data/mod/05_standard/spec/set/self/head_spec.rb +3 -3
- data/mod/05_standard/spec/set/type/email_template_spec.rb +39 -39
- data/mod/05_standard/spec/set/type/file_spec.rb +0 -12
- data/mod/05_standard/spec/set/type/image_spec.rb +26 -2
- data/spec/lib/card/content_spec.rb +169 -154
- data/spec/lib/card/format_spec.rb +7 -7
- data/spec/lib/card/success_spec.rb +1 -1
- metadata +7 -6
- data/lib/card/log.rb +0 -545
- data/mod/05_standard/set/self/performance_log.rb +0 -92
- data/spec/lib/card/log_spec.rb +0 -270
@@ -74,16 +74,4 @@ describe Card::Set::Type::File do
|
|
74
74
|
expect(Card['url test'].file.url).to match /\.png$/
|
75
75
|
end
|
76
76
|
|
77
|
-
context "mod file" do
|
78
|
-
subject { Card[:logo] }
|
79
|
-
describe "#mod_file?" do
|
80
|
-
it "returns the mod name" do
|
81
|
-
expect(subject.mod_file?).to eq('05_standard')
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
it "has correct url " do
|
86
|
-
expect(subject.content).to eq ":#{subject.codename}/05_standard.png"
|
87
|
-
end
|
88
|
-
end
|
89
77
|
end
|
@@ -89,11 +89,35 @@ describe Card::Set::Type::Image do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
describe '*logo mod image' do
|
92
|
+
subject { Card[:logo] }
|
92
93
|
it 'exists' do
|
93
|
-
expect(
|
94
|
+
expect(subject.image.size).to be > 0
|
94
95
|
end
|
95
96
|
it 'has correct url' do
|
96
|
-
expect(
|
97
|
+
expect(subject.image.url).to eq "/files/:logo/05_standard-original.png"
|
98
|
+
end
|
99
|
+
it "has correct url as content" do
|
100
|
+
expect(subject.content).to eq ":#{subject.codename}/05_standard.png"
|
101
|
+
end
|
102
|
+
|
103
|
+
it "becomes a regular file when changed" do
|
104
|
+
Card::Auth.as_bot do
|
105
|
+
subject.update_attributes! :image=>File.new( File.join FIXTURES_PATH, 'rails.gif' )
|
106
|
+
end
|
107
|
+
expect(subject.mod_file?).to be_falsey
|
108
|
+
expect(subject.image.url).to eq "/files/~#{subject.id}/#{subject.last_action_id}-original.gif"
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "#mod_file?" do
|
112
|
+
it "returns the mod name" do
|
113
|
+
expect(subject.mod_file?).to eq('05_standard')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "source view" do
|
118
|
+
it "renders url with medium version" do
|
119
|
+
expect(subject.format.render_source).to eq "/files/:#{subject.codename}/05_standard-medium.png"
|
120
|
+
end
|
97
121
|
end
|
98
122
|
end
|
99
123
|
|
@@ -1,27 +1,118 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'card/content'
|
3
3
|
|
4
|
-
|
5
|
-
:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
EXAMPLES = {
|
5
|
+
:nests => {
|
6
|
+
:content =>
|
7
|
+
[
|
8
|
+
"Some Literals: \\[{I'm not| a link]}, and ",
|
9
|
+
"\\{{This Card|Is not Included}}",
|
10
|
+
", but ",
|
11
|
+
"{{this is}}",
|
12
|
+
", and some tail"
|
13
|
+
].join(''),
|
14
|
+
:rendered =>
|
15
|
+
[
|
16
|
+
"Some Literals: \\[{I'm not| a link]}, and ",
|
17
|
+
"<span>{</span>{This Card|Is not Included}}",
|
18
|
+
", but ",
|
19
|
+
{:options => {:inc_name=>"this is",:inc_syntax=>"this is"}},
|
20
|
+
", and some tail"
|
21
|
+
],
|
22
|
+
:classes => [String, :EscapedLiteral, String, :Include, String ]
|
23
|
+
},
|
24
|
+
|
25
|
+
:links_and_nests => {
|
26
|
+
:content => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}}
|
10
27
|
and [[http://external.wagn.org/path|link text]]{{Included|open}}),
|
11
|
-
|
12
|
-
|
28
|
+
:rendered =>
|
29
|
+
[
|
30
|
+
"Some Links and includes: ",
|
31
|
+
"<a class=\"wanted-card\" href=\"/the_card?card%5Bname%5D=the+card\">the text</a>",
|
32
|
+
", and ",
|
33
|
+
{ :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}},
|
34
|
+
{ :options => { :inc_name=>"this too", :inc_syntax=>"this too"}},
|
35
|
+
"\n and ",
|
36
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://external.wagn.org/path\">link text</a>",
|
37
|
+
{ :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }}
|
38
|
+
],
|
39
|
+
:classes => [String, :Link, String, :Include, :Include, String, :Link, :Include ]
|
40
|
+
},
|
41
|
+
|
42
|
+
:uris_and_links => {
|
43
|
+
:content => %(Some URIs and Links: http://a.url.com/
|
13
44
|
More urls: wagn.com/a/path/to.html
|
14
45
|
http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]]
|
15
46
|
[ http://gerry.wagn.com/a/path ]
|
16
47
|
{ https://brain.org/more?args }),
|
17
|
-
|
48
|
+
:rendered =>
|
49
|
+
[
|
50
|
+
"Some URIs and Links: ", '<a target="_blank" class="external-link" href="http://a.url.com/">http://a.url.com/</a>',
|
51
|
+
"\n More urls: ",
|
52
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
|
53
|
+
"\n ",
|
54
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
|
55
|
+
" ",
|
56
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://brain.org/Home\">extra</a>",
|
57
|
+
"\n [ ",
|
58
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
|
59
|
+
" ]\n { ",
|
60
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
|
61
|
+
" }"
|
62
|
+
],
|
63
|
+
:text_rendered =>
|
64
|
+
[
|
65
|
+
"Some URIs and Links: ", 'http://a.url.com/',
|
66
|
+
"\n More urls: ",
|
67
|
+
"wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]",
|
68
|
+
"\n ",
|
69
|
+
"http://localhost:2020/path?cgi=foo&bar=baz",
|
70
|
+
" ",
|
71
|
+
"extra[http://brain.org/Home]",
|
72
|
+
"\n [ ",
|
73
|
+
"http://gerry.wagn.com/a/path",
|
74
|
+
" ]\n { ",
|
75
|
+
"https://brain.org/more?args",
|
76
|
+
" }"
|
77
|
+
],
|
78
|
+
:classes => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ]
|
79
|
+
},
|
80
|
+
|
81
|
+
:uris_and_links_2 => {
|
82
|
+
:content => %(Some URIs and Links: http://a.url.com
|
18
83
|
More urls: wagn.com/a/path/to.html
|
19
84
|
[ http://gerry.wagn.com/a/path ]
|
20
85
|
{ https://brain.org/more?args }
|
21
86
|
http://localhost:2020/path?cgi=foo&bar=baz [[http://brain.org/Home|extra]]),
|
22
|
-
|
23
|
-
|
24
|
-
|
87
|
+
:rendered =>
|
88
|
+
[
|
89
|
+
"Some URIs and Links: ","<a target=\"_blank\" class=\"external-link\" href=\"http://a.url.com\">http://a.url.com</a>",
|
90
|
+
"\n More urls: ",
|
91
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
|
92
|
+
"\n [ ",
|
93
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
|
94
|
+
" ]\n { ",
|
95
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
|
96
|
+
" }\n ",
|
97
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
|
98
|
+
" ",
|
99
|
+
"<a target=\"_blank\" class=\"external-link\" href=\"http://brain.org/Home\">extra</a>"
|
100
|
+
],
|
101
|
+
:classes => [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ]
|
102
|
+
},
|
103
|
+
|
104
|
+
:no_chunks => {
|
105
|
+
:content => "No chunks",
|
106
|
+
:rendered => "No chunks"
|
107
|
+
},
|
108
|
+
|
109
|
+
:single_nest => {
|
110
|
+
:content => "{{one inclusion|size;large}}",
|
111
|
+
:classes => [:Include]
|
112
|
+
},
|
113
|
+
|
114
|
+
:css => {
|
115
|
+
:content => %~
|
25
116
|
/* body text */
|
26
117
|
body {
|
27
118
|
color: #444444;
|
@@ -44,91 +135,23 @@ CONTENT = {
|
|
44
135
|
h1, h2 {
|
45
136
|
color: #664444;
|
46
137
|
}
|
47
|
-
h1.page-header,
|
138
|
+
h1.page-header,
|
48
139
|
h2.page-header {
|
49
|
-
color: #222299;
|
140
|
+
color: #222299;
|
50
141
|
}
|
51
142
|
~
|
143
|
+
}
|
52
144
|
}
|
53
145
|
|
54
|
-
CLASSES = {
|
55
|
-
:one => [String, :EscapedLiteral, String, :Include, String ],
|
56
|
-
# :two => [String, Chunk::Link, String, Chunk::Include, Chunk::Include, String, Chunk::Link, String, Chunk::Link, Chunk::Link, Chunk::Include ],
|
57
|
-
:two => [String, :Link, String, :Include, :Include, String, :Link, :Include ],
|
58
|
-
:three => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ],
|
59
|
-
:three_b => [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ],
|
60
|
-
:five => [:Include]
|
61
|
-
}
|
62
146
|
|
63
|
-
|
64
|
-
|
65
|
-
|
147
|
+
EXAMPLES.each do |key, val|
|
148
|
+
if val[:classes]
|
149
|
+
val[:classes] = val[:classes].map do |klass|
|
150
|
+
Class === klass ? klass : Card::Chunk.const_get(klass)
|
151
|
+
end
|
66
152
|
end
|
67
153
|
end
|
68
154
|
|
69
|
-
RENDERED = {
|
70
|
-
:one => [
|
71
|
-
"Some Literals: \\[{I'm not| a link]}, and ",
|
72
|
-
"<span>{</span>{This Card|Is not Included}}",
|
73
|
-
", but ",
|
74
|
-
{:options => {:inc_name=>"this is",:inc_syntax=>"this is"}},
|
75
|
-
", and some tail"
|
76
|
-
],
|
77
|
-
:two => [
|
78
|
-
"Some Links and includes: ",
|
79
|
-
"<a class=\"wanted-card\" href=\"/the_card?card%5Bname%5D=the+card\">the text</a>",
|
80
|
-
", and ",
|
81
|
-
{ :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}},
|
82
|
-
{ :options => { :inc_name=>"this too", :inc_syntax=>"this too"}},
|
83
|
-
"\n and ",
|
84
|
-
"<a class=\"external-link\" href=\"http://external.wagn.org/path\">link text</a>",
|
85
|
-
{ :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }}
|
86
|
-
],
|
87
|
-
:three => [
|
88
|
-
"Some URIs and Links: ", '<a class="external-link" href="http://a.url.com/">http://a.url.com/</a>',
|
89
|
-
"\n More urls: ",
|
90
|
-
"<a class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
|
91
|
-
"\n ",
|
92
|
-
"<a class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
|
93
|
-
" ",
|
94
|
-
"<a class=\"external-link\" href=\"http://brain.org/Home\">extra</a>",
|
95
|
-
"\n [ ",
|
96
|
-
"<a class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
|
97
|
-
" ]\n { ",
|
98
|
-
"<a class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
|
99
|
-
" }"
|
100
|
-
],
|
101
|
-
:three_b => [
|
102
|
-
"Some URIs and Links: ","<a class=\"external-link\" href=\"http://a.url.com\">http://a.url.com</a>",
|
103
|
-
"\n More urls: ",
|
104
|
-
"<a class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
|
105
|
-
"\n [ ",
|
106
|
-
"<a class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
|
107
|
-
" ]\n { ",
|
108
|
-
"<a class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
|
109
|
-
" }\n ",
|
110
|
-
"<a class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
|
111
|
-
" ",
|
112
|
-
"<a class=\"external-link\" href=\"http://brain.org/Home\">extra</a>"
|
113
|
-
],
|
114
|
-
:four => "No chunks"
|
115
|
-
}
|
116
|
-
TEXT_RENDERED = {
|
117
|
-
:three => [
|
118
|
-
"Some URIs and Links: ", 'http://a.url.com/',
|
119
|
-
"\n More urls: ",
|
120
|
-
"wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]",
|
121
|
-
"\n ",
|
122
|
-
"http://localhost:2020/path?cgi=foo&bar=baz",
|
123
|
-
" ",
|
124
|
-
"extra[http://brain.org/Home]",
|
125
|
-
"\n [ ",
|
126
|
-
"http://gerry.wagn.com/a/path",
|
127
|
-
" ]\n { ",
|
128
|
-
"https://brain.org/more?args",
|
129
|
-
" }"
|
130
|
-
],
|
131
|
-
}
|
132
155
|
|
133
156
|
describe Card::Content do
|
134
157
|
context "instance" do
|
@@ -151,116 +174,108 @@ describe Card::Content do
|
|
151
174
|
@render_block = Proc.new do |opts| {:options => opts.inject({}) {|i,v| !v[1].nil? && i[v[0]]=v[1]; i } } end
|
152
175
|
end
|
153
176
|
|
177
|
+
let(:example) { EXAMPLES[@example] }
|
178
|
+
let(:cobj) { Card::Content.new example[:content], @card }
|
179
|
+
let(:classes) { example[:classes] }
|
180
|
+
let(:rendered) { example[:rendered] }
|
181
|
+
let(:text_rendered) { example[:text_rendered] }
|
182
|
+
let(:content) { example[:content] }
|
154
183
|
|
155
184
|
describe 'parse' do
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
cobj = Card::Content.new CONTENT[:one], @card
|
160
|
-
expect(cobj.inject(CLASSES[:one], &@check_proc)).to eq(true)
|
161
|
-
end
|
162
|
-
|
163
|
-
it "should give just the chunks" do
|
164
|
-
cobj = Card::Content.new CONTENT[:one], @card
|
165
|
-
clist = CLASSES[:one].find_all {|c| String != c }
|
166
|
-
#warn "clist #{clist.inspect}"
|
185
|
+
def check_chunk_classes
|
186
|
+
expect(cobj.inject(classes, &@check_proc)).to eq(true)
|
187
|
+
clist = classes.find_all {|c| String != c }
|
167
188
|
cobj.each_chunk do |chk|
|
168
189
|
expect(chk).to be_instance_of clist.shift
|
169
190
|
end
|
170
191
|
expect(clist).to be_empty
|
171
192
|
end
|
172
193
|
|
173
|
-
it "
|
174
|
-
|
175
|
-
|
194
|
+
it "finds all the chunks and strings" do
|
195
|
+
# note the mixed [} that are considered matching, needs some cleanup ...
|
196
|
+
@example = :nests
|
197
|
+
expect(cobj.inject(classes, &@check_proc)).to eq(true)
|
176
198
|
end
|
177
199
|
|
178
|
-
it "
|
200
|
+
it "gives just the chunks" do
|
201
|
+
@example = :nests
|
202
|
+
check_chunk_classes
|
203
|
+
end
|
204
|
+
|
205
|
+
it "finds all the chunks links and trasclusions" do
|
206
|
+
@example = :links_and_nests
|
207
|
+
expect(cobj.inject(classes, &@check_proc)).to eq(true)
|
208
|
+
end
|
209
|
+
|
210
|
+
it "finds uri chunks " do
|
179
211
|
# tried some tougher cases that failed, don't know the spec, so hard to form better tests for URIs here
|
180
|
-
|
181
|
-
|
182
|
-
clist = CLASSES[:three].find_all {|c| String != c }
|
183
|
-
#warn "clist #{clist.inspect}, #{cobj.inspect}"
|
184
|
-
cobj.each_chunk do |chk|
|
185
|
-
expect(chk).to be_instance_of clist.shift
|
186
|
-
end
|
187
|
-
expect(clist).to be_empty
|
212
|
+
@example = :uris_and_links
|
213
|
+
check_chunk_classes
|
188
214
|
end
|
189
215
|
|
190
|
-
it "
|
216
|
+
it "finds uri chunks (b)" do
|
191
217
|
# tried some tougher cases that failed, don't know the spec, so hard to form better tests for URIs here
|
192
|
-
|
193
|
-
|
194
|
-
expect(cobj.inject(CLASSES[:three_b], &@check_proc)).to eq(true)
|
195
|
-
clist = CLASSES[:three_b].find_all {|c| String != c }
|
196
|
-
#warn "clist #{clist.inspect}, #{cobj.inspect}"
|
197
|
-
cobj.each_chunk do |chk|
|
198
|
-
expect(chk).to be_instance_of clist.shift
|
199
|
-
end
|
200
|
-
expect(clist).to be_empty
|
218
|
+
@example = :uris_and_links_2
|
219
|
+
check_chunk_classes
|
201
220
|
end
|
202
221
|
|
203
|
-
it "
|
204
|
-
|
205
|
-
expect(cobj).to eq(
|
222
|
+
it "parses just a string" do
|
223
|
+
@example = :no_chunks
|
224
|
+
expect(cobj).to eq(rendered)
|
206
225
|
end
|
207
226
|
|
208
|
-
it "
|
209
|
-
|
210
|
-
|
211
|
-
clist = CLASSES[:five].find_all {|c| String != c }
|
212
|
-
cobj.each_chunk do |chk|
|
213
|
-
expect(chk).to be_instance_of clist.shift
|
214
|
-
end
|
215
|
-
expect(clist).to be_empty
|
227
|
+
it "parses a single chunk" do
|
228
|
+
@example = :single_nest
|
229
|
+
check_chunk_classes
|
216
230
|
end
|
217
|
-
|
218
|
-
it "
|
219
|
-
|
220
|
-
expect(cobj).to eq(
|
231
|
+
|
232
|
+
it "leaves css alone" do
|
233
|
+
@example = :css
|
234
|
+
expect(cobj).to eq(content)
|
221
235
|
end
|
222
236
|
end
|
223
237
|
|
224
238
|
describe "render" do
|
225
|
-
it "
|
226
|
-
|
239
|
+
it "renders all nests" do
|
240
|
+
@example = :nests
|
227
241
|
expect(cobj.as_json.to_s).to match /not rendered/
|
228
242
|
cobj.process_content_object &@render_block
|
229
243
|
expect(rdr=cobj.as_json.to_json).not_to match /not rendered/
|
230
|
-
expect(rdr).to eq(
|
244
|
+
expect(rdr).to eq(rendered.to_json)
|
231
245
|
end
|
232
246
|
|
233
|
-
it "
|
234
|
-
|
247
|
+
it "renders links and nests" do
|
248
|
+
@example = :links_and_nests
|
235
249
|
cobj.process_content_object &@render_block
|
236
250
|
expect(rdr=cobj.as_json.to_json).not_to match /not rendered/
|
237
|
-
expect(rdr).to eq(
|
251
|
+
expect(rdr).to eq(rendered.to_json)
|
238
252
|
end
|
239
253
|
|
240
254
|
it "renders links correctly for text formatters" do
|
255
|
+
@example = :uris_and_links
|
241
256
|
card2 = Card[@card.id]
|
242
257
|
format = card2.format :format => :text
|
243
|
-
cobj = Card::Content.new
|
258
|
+
cobj = Card::Content.new content, format
|
244
259
|
cobj.process_content_object &@render_block
|
245
|
-
expect(cobj.as_json.to_json).to eq(
|
260
|
+
expect(cobj.as_json.to_json).to eq(text_rendered.to_json)
|
246
261
|
end
|
247
262
|
|
248
|
-
it "
|
249
|
-
|
263
|
+
it "does not need rendering if no nests" do
|
264
|
+
@example = :uris_and_links
|
250
265
|
cobj.process_content_object &@render_block
|
251
|
-
expect(cobj.as_json.to_json).to eq(
|
266
|
+
expect(cobj.as_json.to_json).to eq(rendered.to_json)
|
252
267
|
end
|
253
268
|
|
254
|
-
it "
|
255
|
-
|
269
|
+
it "does not need rendering if no nests (b)" do
|
270
|
+
@example = :uris_and_links_2
|
256
271
|
expect(rdr=cobj.as_json.to_json).to match /not rendered/ # links are rendered too, but not with a block
|
257
272
|
cobj.process_content_object &@render_block
|
258
273
|
expect(rdr=cobj.as_json.to_json).not_to match /not rendered/
|
259
|
-
expect(rdr).to eq(
|
274
|
+
expect(rdr).to eq(rendered.to_json)
|
260
275
|
end
|
261
276
|
end
|
262
277
|
end
|
263
|
-
|
278
|
+
|
264
279
|
UNTAGGED_CASES = [ ' [grrew][/wiki/grrew]ss ', ' {{this is a test}}, {{this|view|is:too}} and',
|
265
280
|
' so is http://foo.bar.come//', ' and foo="my attr, not int a tag" <not a=tag ', ' p class"foobar"> and more' ]
|
266
281
|
|
@@ -271,7 +286,7 @@ describe Card::Content do
|
|
271
286
|
assert_equal test_case,Card::Content.clean!(test_case)
|
272
287
|
end
|
273
288
|
end
|
274
|
-
|
289
|
+
|
275
290
|
it 'should strip disallowed html class attributes' do
|
276
291
|
assert_equal '<p>html<div>with</div> funky tags</p>', Card::Content.clean!('<p>html<div class="boo">with</div><monkey>funky</butts>tags</p>')
|
277
292
|
assert_equal '<span>foo</span>', Card::Content.clean!('<span class="banana">foo</span>')
|
@@ -320,7 +335,7 @@ describe Card::Content do
|
|
320
335
|
end
|
321
336
|
end
|
322
337
|
end
|
323
|
-
|
324
|
-
|
338
|
+
|
339
|
+
|
325
340
|
end
|
326
341
|
|