corrade-nucleus-nucleons – Blame information for rev 6
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | (function(){ |
2 | |||
3 | 'use strict'; |
||
4 | |||
5 | describe('A form with unchecked radios', function(){ |
||
6 | |||
7 | beforeEach(function () { |
||
8 | var html = '' + |
||
9 | '<form id="newForm">' + |
||
10 | '<input type="radio" name="first" value="First value">' + |
||
11 | '<input type="radio" name="second" value="First value">' + |
||
12 | '<input type="radio" name="third" value="First value">' + |
||
13 | '<input type="radio" name="third" value="Second value">' + |
||
14 | '<input type="radio" name="third" value="Third value">' + |
||
15 | '</form>'; |
||
16 | var $newForm = document.createElement('div'); |
||
17 | $newForm.id = 'fixtures'; |
||
18 | $newForm.innerHTML = html; |
||
19 | document.body.appendChild($newForm); |
||
20 | }); |
||
21 | |||
22 | afterEach(function () { |
||
23 | document.body.removeChild(document.getElementById('fixtures')); |
||
24 | }); |
||
25 | |||
26 | it('searched by a valid element string should return false', function(){ |
||
27 | expect(formToObject('newForm')).toBe(false); |
||
28 | }); |
||
29 | |||
30 | }); |
||
31 | |||
32 | |||
33 | describe('A form with various radio elements checked', function(){ |
||
34 | |||
35 | beforeEach(function () { |
||
36 | var html = '' + |
||
37 | '<form id="newForm">' + |
||
38 | '<input type="radio" name="first" value="First value from first" checked>' + |
||
39 | '<input type="radio" name="second" value="First value from second" checked="checked">' + |
||
40 | '<input type="radio" name="third" value="First value">' + |
||
41 | '<input type="radio" name="third" value="Second value" checked>' + |
||
42 | '<input type="radio" name="third" value="Third value">' + |
||
43 | // Numeric values
|
||
44 | '<input type="radio" name="fourth" value="0" checked>' + |
||
45 | '<input type="radio" name="fourth" value="1">' + |
||
46 | '<input type="radio" name="fourth" value="2">' + |
||
47 | '</form>'; |
||
48 | var $newForm = document.createElement('div'); |
||
49 | $newForm.id = 'fixtures'; |
||
50 | $newForm.innerHTML = html; |
||
51 | document.body.appendChild($newForm); |
||
52 | }); |
||
53 | |||
54 | afterEach(function () { |
||
55 | document.body.removeChild(document.getElementById('fixtures')); |
||
56 | }); |
||
57 | |||
58 | it('searched by a valid element string should return an object with checked elements', function(){ |
||
59 | expect(formToObject('newForm')).toEqual({ |
||
60 | 'first': 'First value from first', |
||
61 | 'second': 'First value from second', |
||
62 | 'third': 'Second value', |
||
63 | 'fourth': '0' |
||
64 | }); |
||
65 | }); |
||
66 | |||
67 | }); |
||
68 | |||
69 | })(); |