bard-tag_field 0.3.0 → 0.4.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: 6f2e7769c2bbc3f424922811fb57fe48207c029af24b926b543550bcbdc525b5
4
- data.tar.gz: 0f33799fff29c82c007553aa13df5f50ab4c96f271c689726d851e4e2d9b592e
3
+ metadata.gz: 2710ff20fb473cf6eef8319d72f88cf59b0f3c24cca66badbad936f644df368b
4
+ data.tar.gz: e16029c932fc9329796d05b587dd8a5697d59a99a0db9692f15c8b37bfaa04c1
5
5
  SHA512:
6
- metadata.gz: ec37d61083dd7f262bf358ed179b2a53d51df0e82cd0606746c5da0f1b2e77ee89a62222f27777de24b4308ee3b4f6924799f1238bf68b0402692105070487bf
7
- data.tar.gz: c2856f864d7674102f7d679399959e19af91b96c44c933f24995332241ca2b70c0e84a426a5ecdcf593fd22aee374d8d40d802699c8f2b892a8871da84dd3863
6
+ metadata.gz: 5694eb901dd9ce23e13b1685da503150c3adbf7fb102124b7c9c3f7114dfffaeb56e6f8d000606e96172f2ae21193a8d8eb47c7e2c1cb625f4579c38271321a3
7
+ data.tar.gz: b812a1d58f7280aca270133b0b6ff372b0d406c9122fd7b42a5ec17073104baf6a0242000cedc9075f5f8a9a9f29c24ff30f2f5dc060a0b20c17e2445a655099
@@ -1147,10 +1147,25 @@ class InputTag extends HTMLElement {
1147
1147
  }
1148
1148
 
1149
1149
  get value() {
1150
- return this._internals.value;
1150
+ const internalValue = this._internals.value;
1151
+ if (this.hasAttribute('multiple')) {
1152
+ return internalValue; // Return array for multiple mode
1153
+ } else {
1154
+ return internalValue.length > 0 ? internalValue[0] : ''; // Return string for single mode
1155
+ }
1151
1156
  }
1152
1157
 
1153
- set value(values) {
1158
+ set value(input) {
1159
+ // Convert input to array format for internal storage
1160
+ let values;
1161
+ if (Array.isArray(input)) {
1162
+ values = input;
1163
+ } else if (typeof input === 'string') {
1164
+ values = input === '' ? [] : [input];
1165
+ } else {
1166
+ values = [];
1167
+ }
1168
+
1154
1169
  const oldValues = this._internals.value;
1155
1170
  this._internals.value = values;
1156
1171
 
@@ -14,6 +14,18 @@ class Chop::Form::TagField < Chop::Form::Field
14
14
  def diff_value
15
15
  get_value.join(", ")
16
16
  end
17
+
18
+ def set_value
19
+ if field[:multiple]
20
+ value.to_s.split(", ").map(&:strip)
21
+ else
22
+ value.to_s.strip
23
+ end
24
+ end
25
+
26
+ def fill_in!
27
+ session.execute_script("document.getElementById('#{field[:id]}').value = #{set_value.to_json}")
28
+ end
17
29
  end
18
30
 
19
31
  When "I fill in the {string} tag field with {string}" do |field, value|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module TagField
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-tag_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-22 00:00:00.000000000 Z
11
+ date: 2025-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails