File: test/each.js

Recommend this page to a friend!
  Classes of Javier Camelis   JavaScript Multi Key Array   test/each.js   Download  
File: test/each.js
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: JavaScript Multi Key Array
Set and get values from arrays using multiple keys
Author: By
Last change: Update of test/each.js
Date: 2 years ago
Size: 896 bytes


Class file image Download
module("Each Iterator Test Module"); test( "Each Iterator", function() { var firstKey1 = 'foo1'; var firstKey2 = 'foo2'; var firstKey3 = 'foo3'; var secondKey1 = 'var1'; var secondKey2 = 'var2'; var secondKey3 = 'var3'; var values = ['test0', 'test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7', 'test8']; var map = MultiKey(); map.set([firstKey1, secondKey1], values[0]); map.set([firstKey1, secondKey2], values[1]); map.set([firstKey1, secondKey3], values[2]); map.set([firstKey2, secondKey1], values[3]); map.set([firstKey2, secondKey2], values[4]); map.set([firstKey2, secondKey3], values[5]); map.set([firstKey3, secondKey1], values[6]); map.set([firstKey3, secondKey2], values[7]); map.set([firstKey3, secondKey3], values[8]); var i = 0; map.each(function(){ this.each(function(){ deepEqual(values[i], this.value, "Passed!" ); i++; }); }); });