d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai<html>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai<head>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai <title>State Tests</title>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai <script type="text/javascript" src="/build/yui/yui.js"></script>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai <style type="text/css">
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai #console .yui3-console-entry {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai padding:2px;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai margin:0px;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai min-height:0;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai #console .yui3-console-entry-fail .yui3-console-entry-cat {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai background-color:red;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai #console .yui3-console-entry-pass .yui3-console-entry-cat {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai background-color:green;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai #console .yui3-console-entry-perf .yui3-console-entry-cat {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai background-color:blue;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai #console {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai position:static;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai html, body {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai height:100%;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai </style>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai <script type="text/javascript">
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai YUI({
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai useBrowserConsole:false,
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }).use("dump", "attribute-core", "console", "test", function(Y) {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var basicTemplate = {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai name: "State Tests",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testInstantiation : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isObject(s.data);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.ObjectAssert.ownsNoKeys(s.data);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testAdd : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("A", "keyOne", "valueAOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne", s.get("A", "keyOne"), "Initial add failed");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("A", "keyTwo", "valueATwo");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne", s.get("A", "keyOne"), "Second add broke initial add");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueATwo", s.get("A", "keyTwo"), "Second add failed");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("A", "keyOne", "valueAOne-updated");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne-updated", s.get("A", "keyOne"), "Update add failed");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("B", "keyOne", "valueBOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"), "Second name add failed");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testGet : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("A", "keyOne", "valueAOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("B", "keyOne", "valueBOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne", s.get("A", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("B", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("C", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("C", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testAddAll : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai a = {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai };
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("A", a);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areNotSame(s.data["A"], a);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne", s.get("A", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueATwo", s.get("A", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAThree", s.get("A", "keyThree"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyFour"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("B", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueBOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueBTwo"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBTwo", s.get("B", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testGetAll : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("A", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var shallow = s.getAll("A");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areNotSame(shallow, s.data["A"]);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.ObjectAssert.areEqual({
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }, shallow);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var ref = s.getAll("A", true);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areSame(ref, s.data["A"]);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.ObjectAssert.areEqual({
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }, ref);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.getAll("B"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testRemove : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("A", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("B", "keyOne", "valueBOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.remove("A", "keyOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueATwo", s.get("A", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAThree", s.get("A", "keyThree"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testRemoveAll : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("B", "keyOne", "valueBOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("A", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.removeAll("A");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyThree"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.getAll("A"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testRemoveAllArray : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("B", "keyOne", "valueBOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("A", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.removeAll("A", ["keyTwo", "keyThree"]);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyThree"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isObject(s.getAll("A"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne", s.get("A", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai },
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai testRemoveAllObject : function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var s = new Y.State();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.add("B", "keyOne", "valueBOne");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.addAll("A", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyOne: "valueAOne",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyTwo: "valueATwo",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai keyThree: "valueAThree"
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai s.removeAll("A", {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai "keyTwo" : true,
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai "keyThree" : ""
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyTwo"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isUndefined(s.get("A", "keyThree"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.isObject(s.getAll("A"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueAOne", s.get("A", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Assert.areEqual("valueBOne", s.get("B", "keyOne"));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai };
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
4dde8ac845fcdfa95d8ef2662b10e98f7619a48eSatyen Desai var suite = new Y.Test.Suite({name:"State Unit Tests"});
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai suite.add(new Y.Test.Case(basicTemplate));
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Test.Runner.add(suite);
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Test.Runner.setName("State Tests");
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Test.Runner.disableLogging();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Test.Runner.run();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai var console;
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.one("#btnRun").set("disabled", false).on("click", function() {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai if (!console) {
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai //create the console
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai console = new Y.Console({
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai width:"100%",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai height:"95%",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai id:"console",
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai verbose : false,
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai printTimeout: 0,
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai newestOnTop : false,
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai entryTemplate: '<pre class="{entry_class} {cat_class} {src_class}">'+
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai '<span class="{entry_cat_class}">{label}</span>'+
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai '<span class="{entry_content_class}">{message}</span>'+
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai '</pre>',
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai render:true
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai }
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Test.Runner.enableLogging();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai Y.Test.Runner.run();
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai });
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai </script>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai</head>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai<body class="yui3-skin-sam">
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai <p><input type="button" value="Run Tests" id="btnRun" disabled=true></p>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai</body>
d2fe481f82326b03c9a545af61f3379ac5d7fef1Satyen Desai</html>