Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test cases for issues #241 and #260.

  • Loading branch information...
commit 27c44b07a0c338e83a22ccb22cfd92f843e1026e 1 parent abf3329
nauhygon authored
Showing with 61 additions and 3 deletions.
  1. +25 −3 spec/cookie_spec.coffee
  2. +36 −0 spec/forms_spec.coffee
28 spec/cookie_spec.coffee
View
@@ -55,11 +55,33 @@ Vows.describe("Cookies").addBatch(
assert.isUndefined cookies.get("_domain2")
assert.isUndefined cookies.get("_domain3")
- "host in domain":
+ "same domain (.localhost)":
+ topic: (browser)->
+ browser.cookies(".localhost")
+ "should have access to domain cookies": (cookies)->
+ assert.equal cookies.get("_name"), "value"
+ "should have access to .host cookies": (cookies)->
+ assert.equal cookies.get("_domain1"), "here"
+ "should not have access to other hosts' cookies": (cookies)->
+ assert.isUndefined cookies.get("_domain2")
+ assert.isUndefined cookies.get("_domain3")
+
+ "subdomain (host.localhost)":
topic: (browser)->
browser.cookies("host.localhost")
- "should not have access to domain cookies": (cookies)->
- assert.isUndefined cookies.get("_name")
+ "should have access to domain cookies": (cookies)->
+ assert.equal cookies.get("_name"), "value"
+ "should have access to .host cookies": (cookies)->
+ assert.equal cookies.get("_domain1"), "here"
+ "should not have access to other hosts' cookies": (cookies)->
+ assert.isUndefined cookies.get("_domain2")
+ assert.isUndefined cookies.get("_domain3")
+
+ "subdomain in subdomain (subdomain.host.localhost)":
+ topic: (browser)->
+ browser.cookies("subdomain.host.localhost")
+ "should have access to domain cookies": (cookies)->
+ assert.equal cookies.get("_name"), "value"
"should have access to .host cookies": (cookies)->
assert.equal cookies.get("_domain1"), "here"
"should not have access to other hosts' cookies": (cookies)->
36 spec/forms_spec.coffee
View
@@ -48,6 +48,20 @@ Vows.describe("Forms").addBatch(
<option>neither</option>
</select>
+ <select name="months" id="field-months">
+ <option value=""></option>
+ <option value="jan_2011">Jan 2011</option>
+ <option value="feb_2011">Feb 2011</option>
+ <option value="mar_2011">Mar 2011</option>
+ </select>
+
+ <select name="months2" id="field-months2">
+ <option value=""></option>
+ <option value="jan_2011">Jan 2011</option>
+ <option value="feb_2011">Feb 2011</option>
+ <option value="mar_2011"> Mar 2011 </option>
+ </select>
+
<span>First address</span>
<label for='address1_street'>Street</label>
<input type="text" name="addresses[][street]" value="" id="address1_street">
@@ -340,6 +354,28 @@ Vows.describe("Forms").addBatch(
"should fire change event": (browser)->
assert.ok browser.stateChanged
+ "select name using option text":
+ topic: (browser)->
+ browser.select "months", "Jan 2011"
+ "should set value": (browser)->
+ assert.equal browser.querySelector("#field-months").value, "jan_2011"
+ "should select second option": (browser)->
+ selected = (!!option.getAttribute("selected") for option in browser.querySelector("#field-months").options)
+ assert.deepEqual selected, [false, true, false, false]
+ "should fire change event": (browser)->
+ assert.ok browser.stateChanged
+
+ "select name using option text with leading/trailing spaces":
+ topic: (browser)->
+ browser.select "months2", "Mar 2011"
+ "should set value": (browser)->
+ assert.equal browser.querySelector("#field-months2").value, "mar_2011"
+ "should select second option": (browser)->
+ selected = (!!option.getAttribute("selected") for option in browser.querySelector("#field-months2").options)
+ assert.deepEqual selected, [false, false, false, true]
+ "should fire change event": (browser)->
+ assert.ok browser.stateChanged
+
"select option value directly":
topic: (browser)->
browser.selectOption browser.querySelector("#option-killed-thousands")
Please sign in to comment.
Something went wrong with that request. Please try again.