Skip to content

Commit 2c48686

Browse files
committed
Add specs for additional set types
1 parent 4eba71f commit 2c48686

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

spec/features/driver_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,30 @@ def create_screenshot(file, *args)
14681468
expect(input.text).to eq("replacement text")
14691469
end
14701470

1471+
it "sets a date field" do
1472+
input = @session.find(:css, "#date-field")
1473+
input.set(Time.new(2000, 12, 31))
1474+
expect(input.value).to eq("2000-12-31")
1475+
end
1476+
1477+
it "sets a datetime-local field" do
1478+
input = @session.find(:css, "#datetime-local-field")
1479+
input.set(Time.new(2000, 12, 31, 17, 15))
1480+
expect(input.value).to eq(Time.new(2000, 12, 31, 17, 15).strftime("%Y-%m-%dT%H:%M"))
1481+
end
1482+
1483+
it "sets a range field" do
1484+
input = @session.find(:css, "#range-field")
1485+
input.set(42)
1486+
expect(input.value).to eq("42")
1487+
end
1488+
1489+
it "sets a color field" do
1490+
input = @session.find(:css, "#color-field")
1491+
input.set("#1270a4")
1492+
expect(input.value).to eq("#1270a4")
1493+
end
1494+
14711495
it "sets a content editable childs content" do
14721496
@session.visit("/with_js")
14731497
@session.find(:css, "#existing_content_editable_child").set("WYSIWYG")

spec/support/views/set.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@
88
<body>
99
<div id="empty_div" contenteditable="true"></div>
1010
<div id="filled_div" contenteditable="true">Content</div>
11+
<form>
12+
<input id="date-field" type="date" name="date-field"><br>
13+
<input id="datetime-local-field" type="datetime-local" name="datetime-local-field"><br>
14+
<input id="range-field" type="range" min="0" max="100" name="range-field"><br>
15+
<input id="color-field" type="color" name="color-field">
16+
</form>
1117
</body>
1218
</html>

0 commit comments

Comments
 (0)