bard-tag_field 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b02f3ddad60e5123de67a5eabce0f7055f78ca2acacc6420e6f8217619040b9
4
- data.tar.gz: d5e46540cba56d49a543f4ce5493ad7049271546134c03e7cc5fac6ed145e00d
3
+ metadata.gz: 6f2e7769c2bbc3f424922811fb57fe48207c029af24b926b543550bcbdc525b5
4
+ data.tar.gz: 0f33799fff29c82c007553aa13df5f50ab4c96f271c689726d851e4e2d9b592e
5
5
  SHA512:
6
- metadata.gz: f8b3e7375d573b1b388cdb834b521b1196bd0a037cf709c2ca3b953c46f9b174b2731d7eb6e6e0c2d1681343658fb554585a3a2e7e949630268f1973a3c5b7e9
7
- data.tar.gz: cdbfa395648b8d5b593552bebe246607309ff62cbe11c514a70e5ba960c9717efa6bb41b19fd0eb0566e1b378d9f9412bdbc193d32b09bc929ce463ecbe2b82e
6
+ metadata.gz: ec37d61083dd7f262bf358ed179b2a53d51df0e82cd0606746c5da0f1b2e77ee89a62222f27777de24b4308ee3b4f6924799f1238bf68b0402692105070487bf
7
+ data.tar.gz: c2856f864d7674102f7d679399959e19af91b96c44c933f24995332241ca2b70c0e84a426a5ecdcf593fd22aee374d8d40d802699c8f2b892a8871da84dd3863
@@ -0,0 +1,65 @@
1
+ class Chop::Form::TagField < Chop::Form::Field
2
+ def self.css_selector
3
+ "input-tag"
4
+ end
5
+
6
+ def matches?
7
+ field.tag_name == "input-tag"
8
+ end
9
+
10
+ def get_value
11
+ field.all("tag-option").map(&:text)
12
+ end
13
+
14
+ def diff_value
15
+ get_value.join(", ")
16
+ end
17
+ end
18
+
19
+ When "I fill in the {string} tag field with {string}" do |field, value|
20
+ find_input_tag_field(field).click
21
+ page.driver.browser.keyboard.type(value)
22
+ end
23
+
24
+ When "I remove {string} from the {string} tag field" do |value, field|
25
+ within find_input_tag_field(field) do
26
+ within find("tag-option", text: value).shadow_root do
27
+ find("button").trigger("click")
28
+ end
29
+ end
30
+ end
31
+
32
+ Then "I should see the following {string} tag field:" do |field, table|
33
+ tags = input_tag_value(find_input_tag_field(field))
34
+ table.diff! [tags]
35
+ end
36
+
37
+ Then "I should see an empty {string} tag field" do |field|
38
+ expect(find_input_tag_field(field)).to have_no_css("tag-option")
39
+ end
40
+
41
+ Then "I should see the following {string} available tag options:" do |field, table|
42
+ field = find_input_tag_field(field)
43
+ options = field.all("datalist option", visible: false).map { |e| e[:innerText] }
44
+ expect(options).to eq(table.raw.flatten)
45
+ end
46
+
47
+ Then "I should see the following {string} tag field autocomplete options:" do |field, table|
48
+ within find_input_tag_field(field).shadow_root do
49
+ expect(all("li").map(&:text)).to eq(table.raw.flatten)
50
+ end
51
+ end
52
+
53
+ def find_input_tag_field(label)
54
+ find("##{find("label", text: label)[:for]}")
55
+ end
56
+
57
+ def input_tag_value(field)
58
+ field.all("tag-option").map(&:text)
59
+ end
60
+
61
+ def input_tag_field actual, root, label: "Labels"
62
+ index = actual.index { |row| row.first == "Description" }
63
+ tags = input_tag_value(find_input_tag_field(label))
64
+ actual.insert index, [label, tags.join(", ")]
65
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module TagField
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-tag_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
@@ -92,6 +92,7 @@ files:
92
92
  - gemfiles/rails_7.2.gemfile
93
93
  - gemfiles/rails_8.0.gemfile
94
94
  - lib/bard/tag_field.rb
95
+ - lib/bard/tag_field/cucumber.rb
95
96
  - lib/bard/tag_field/field.rb
96
97
  - lib/bard/tag_field/form_builder.rb
97
98
  - lib/bard/tag_field/version.rb