releaf-core 1.1.9 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b521cc7cd192eb97b730229a116271549cdc9af9
4
- data.tar.gz: 9d7c036cf98ca78f76221876beb81783b44d7679
3
+ metadata.gz: b6decd4843ef46c517dd49e0956100083c5e161c
4
+ data.tar.gz: e6cc6c0f986e57291fc9ab2fc3d3b15b999e28bb
5
5
  SHA512:
6
- metadata.gz: 7af35f119df3980231bd08699bd06cc79032903732531302e267ccbc429e2712b93cf2a7b270ce4707b0a5928749a6771f4bdefc94dbd9815eac4061f633ba4f
7
- data.tar.gz: ec3fc1ab66443ef043ee2b0e8bb8623c6d9b800ed45986962a14a2a40e0302fa684f8c22dec55dc8972d890221465ea4c07ed2966b166170c4e54f2dd45822a6
6
+ metadata.gz: 23e0130f715ac08a4cb5a9964f5bb4028e44e8a846d49589a9fbb4c6d3883d723a7edc36944d648e58008fcf022f0cc506ca4c360b3308642d864bd25057f6f6
7
+ data.tar.gz: 49f635d45eb72d755afdfc9a9a2d93d66924cc579e43368dcf461b4e2f61f7141db9b0c04ac8aeebd7ad1fabaf8247970b9e568517803fef30814a48ef81826f
@@ -145,6 +145,10 @@ class Releaf::Builders::TableBuilder
145
145
  truncate(column_value(resource, column).to_s, length: 32, separator: ' ')
146
146
  end
147
147
 
148
+ def format_textarea_content(resource, column)
149
+ format_text_content(resource, column)
150
+ end
151
+
148
152
  def format_string_content(resource, column)
149
153
  value = column_value(resource, column)
150
154
  resource_title(value)
@@ -34,6 +34,6 @@ class Releaf::Settings < RailsSettings::Base
34
34
  end
35
35
 
36
36
  def self.supported_types
37
- [:boolean, :date, :time, :datetime, :integer, :float, :decimal, :email, :text]
37
+ [:boolean, :date, :time, :datetime, :integer, :float, :decimal, :email, :text, :textarea]
38
38
  end
39
39
  end
@@ -364,6 +364,21 @@ describe Releaf::Builders::TableBuilder, type: :class do
364
364
  end
365
365
  end
366
366
 
367
+ describe "#format_textarea_content" do
368
+ it "returns truncated and escape column value" do
369
+ allow(subject).to receive(:column_value).with(resource, :title)
370
+ .and_return('"Pra<tag>nt commodo\ncursus magn')
371
+ expect(subject.format_textarea_content(resource, :title))
372
+ .to eq('&quot;Pra&lt;tag&gt;nt commodo\ncursus magn')
373
+ end
374
+
375
+ it "casts value to string before truncation" do
376
+ allow(subject).to receive(:column_value).with(resource, :title)
377
+ .and_return(nil)
378
+ expect(subject.format_textarea_content(resource, :title)).to eq("")
379
+ end
380
+ end
381
+
367
382
  describe "#format_string_content" do
368
383
  context "when resource column value respond to #resource_title method" do
369
384
  it "returns resource to title result" do
@@ -6,14 +6,15 @@ feature "Settings", js: true do
6
6
  {key: "content.updated", default: true, description: "Content is updated?", type: :boolean},
7
7
  {key: "content.rating", default: 5.65, type: :decimal},
8
8
  {key: "content.title", default: "some"},
9
- {key: "content.date", default: DateTime.parse("2015-05-02"), type: "date"}
9
+ {key: "content.date", default: DateTime.parse("2015-05-02"), type: "date"},
10
+ {key: "content.textarea", type: :textarea},
10
11
  ]
11
12
  Releaf::Settings.destroy_all
12
13
  Releaf::Settings.register(*values)
13
14
  auth_as_user
14
15
 
15
16
  visit releaf_settings_path
16
- expect(page).to have_number_of_resources(5)
17
+ expect(page).to have_number_of_resources(6)
17
18
  expect(page).to have_css(".table.releaf\\/settings tbody tr:first-child td:first-child", text: "content.date")
18
19
  expect(page).to have_css(".table.releaf\\/settings tbody tr:first-child td:nth-child(2)", text: /^Sat, 02 May 2015 00:00:00 \+0000$/)
19
20
  expect(page).to have_css(".table.releaf\\/settings tbody tr:last-child td:first-child", text: "content.updated_at")
@@ -39,5 +40,19 @@ feature "Settings", js: true do
39
40
  click_link "content.rating"
40
41
  expect(page).to have_field("Value")
41
42
  expect(page).to have_css(".field input[type='number'][value='5.65']")
43
+
44
+ click_link "Back to list"
45
+
46
+ click_link "content.textarea"
47
+ expect(page).to have_field("Value")
48
+ expect(page).to have_css(".field textarea[name='resource[value]']")
49
+
50
+ update_resource do
51
+ fill_in "Value", with: "AA\nBB\nCC\nDD\n"
52
+ end
53
+ click_link "Back to list"
54
+
55
+ expect(Releaf::Settings["content.textarea"]).to eq("AA\r\nBB\r\nCC\r\nDD\r\n")
56
+ expect(page).to have_content("AA\nBB\nCC\nDD\n")
42
57
  end
43
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releaf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - CubeSystems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-15 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails