Garlic test suite for jQuery, unminified version
passes: 45
failures: 9
duration: 2.59s
Garlic.js test suite
Test getPath
✓
getPath() for #input1 ‣
✓
getPath() for #div1 ‣
✓
getPath() for #textarea2 ‣
✓
getPath() for #checkbox1 ‣
✓
getPath() for #checkbox2 ‣
✓
getPath() for #radio1 ‣
✓
getPath() for #radio2, should be same as #radio1 ‣
✓
getPath() for elements with domain=true ‣
Test Garlic storage
✓
Test has() ‣
✓
Test set() ‣
✓
Test get() ‣
✓
Test destroy() ‣
Test inputs binding
✓
On a simple form with only one input[type=text] ‣
expect( $( '#input1' ).hasClass( 'garlic-auto-save' ) ).to.be( true );
✖
On a simple form with only one input[type=text] and a textarea ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:79:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✓
On a div which is obviously not a form ‣
✖
On a single form element, not the wole form ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:86:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✓
On a select input ‣
✓
On a checkboxes inputs ‣
✖
On a radio buttons ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:99:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✓
On a form without data-persist, binded manually in javascript ‣
✖
On a form that has data-storage="false" inputs ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:106:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✖
On a form that is of type number ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:109:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✖
On a form that is of type tel ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:112:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✖
On a form that is of type email ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:115:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4006:7)
at next (http://garlicjs.org/tests/mocha.js:3954:16)
✓
On a form that is of type password ‣
Test inputs events
✓
Data is persisted on supported events: DOMAttrModified, textInput, input, change, keypress, paste, focus ‣
Test input data retrieving
✓
An input should be populated by its stored data ‣
✓
Select must be setted accordingly to storage ‣
✓
Radio buttons must be checked accordingly to storage ‣
✓
Checkboxes buttons must be checked accordingly to storage ‣
✓
If custom retrieval function is defined, execute it ‣
Auto expiration feature
✖
If data auto-expires, data is persisted an expires flag is set in localStorage ‣
Error: expected null to equal 'foo'
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:200:11)
at dispatch (http://garlicjs.org/resources/jquery-1.8.2.min.js:2:37951)
at h (http://garlicjs.org/resources/jquery-1.8.2.min.js:2:33788)
at trigger (http://garlicjs.org/resources/jquery-1.8.2.min.js:2:36599)
at Anonymous function (http://garlicjs.org/resources/jquery-1.8.2.min.js:2:44364)
at each (http://garlicjs.org/resources/jquery-1.8.2.min.js:2:14472)
at each (http://garlicjs.org/resources/jquery-1.8.2.min.js:2:11142)
✓
If data-expires is set on a form item, all form fields have the same expiration date, and this date updates each time one of them item is updated ‣
✖
Data is not persisted in localStorage anymore after expiration time ‣
Error: expected false to equal true
at assert (http://garlicjs.org/tests/expect.js:99:7)
at equal (http://garlicjs.org/tests/expect.js:200:5)
at Anonymous function (http://garlicjs.org/tests/expect.js:73:13)
at Anonymous function (http://garlicjs.org/tests/tests.js:244:11)
at garlic (http://garlicjs.org/garlic.js:389:5)
at Anonymous function (http://garlicjs.org/tests/tests.js:243:9)
at run (http://garlicjs.org/tests/mocha.js:3716:24)
at runTest (http://garlicjs.org/tests/mocha.js:4071:5)
at Anonymous function (http://garlicjs.org/tests/mocha.js:4117:7)
at next (http://garlicjs.org/tests/mocha.js:3997:7)
Test input data change
✓
If some text is added / removed in a textarea or an input[type=text], it should be updated in storage ‣
✓
If a text field is willingly cleared by an user, its storage will also be cleared ‣
✓
If a select is changed, new value should be stored ‣
✓
If radio button is selected, value or new value should be stored ‣
✓
Same, but with radio buttons not at the same DOM level ‣
$( '#radio2' ).val( 'bar' );
$( '#radio2' ).trigger( 'change', function () {
expect( garlicStorage.get( $( '#radio2' ).garlic( 'getPath' ) ) ).to.be( 'bar' );
} )
✓
If a checkbox is checked, its state should be persisted ‣
✓
Same, but with checkboxes not at the same DOM level ‣
✓
If a checkbox is unchecked, its state should be removed from storage ‣
Conflicts management
✓
If input,textarea,select fields have default value and conflictManager enabled, detect conflict41ms ‣
✓
If input,textarea,select fields have default value and conflictManager enabled, display swap handler next to it ‣
✓
If garlicPriority is set to true (default), display for input,textarea,select persisted data ‣
✓
If swap action is triggered, change data for input,textarea,select fields ‣
✓
If swap action is triggered, again change data again for input,textarea,select fields ‣
✓
If garlicPriority is set to false, display default data and swap with persisted one ‣
Test input data destroy
✓
submit;reset button should destroy input;textarea;select;checkbox;radio fields persisted data ‣
✓
Reset button should remove both text and localStorage, but only on current form ‣
✓
Destroy localStorage when garlic( 'destroy' ) is manually fired on an elem ‣
✓
Do not destroy localStorage if data-destroy=false ‣
Final tests that clean/clear localStorage
✓
Test clean() ‣
✓
Test clear() ‣