$.define("data","more/spec,data",function(){
    $.fixture('数据缓存模块-data', {
        "$.data":function(){
            //使用了data方法的元素或对象都会添加一个叫uniqueNumber的数字属性
            $.data(document.body,"test1",[1,2,3]);
            expect(typeof document.body.uniqueNumber === "number").ok();
            expect($.data(document.body,"test1")).same([1,2,3]);
            var val = $.data(document.body,"test2",{
                aa:"aa",
                bb:"bb"
            });
            //测试返回值
            expect(val).same({
                aa:"aa",
                bb:"bb"
            });
           
        },
        "$.mergeData":function(){
            var a = {};
            //写入数揣
            $.data(a,"name","司徒正美");
            //写入一个复杂的数据
            $.data(a,"obj",{
                ee:[1,2,3,{
                    aa:"aa",
                    bb:"bb"
                }],
                dd:function(){},
                date:new Date
            });
            var b = {};
            $.data(b,"sex","man");
            //合并数据
            $.mergeData(b,a);
            expect($.data(a)).log()
            expect($.data(b)).log()
            delete $.data(b).sex;
            expect($.data(a)).same($.data(b))
        },
        "$.removeData":function(){
            var val = $.removeData(document.body,"test1");
            expect(val).same([1,2,3]);
            $.removeData(document.body);
            expect($.data(document.body)).same({});
        }

    });
});

@@ -1459,18 +1459,815 @@
    %7D
-%0A%0A    %7D);%0A%7D);%0A
+,%0A        %22$.parseData%22:function()%7B%0A            document.body.setAttribute(%22data-object%22,%22%7Ba:1,b:2,c:3%7D%22)%0A            var data = $.parseData(document.body, %22data-object%22)%0A            expect(data).same(%7B%0A                a:1,%0A                b:2,%0A                c:3%0A            %7D);%0A            document.body.setAttribute(%22data-array%22,%22%5B1,2,3%5D%22)%0A            data = $.parseData(document.body, %22data-array%22);%0A            expect(data).same(%5B1,2,3%5D);%0A            document.body.setAttribute(%22data-null%22,%22null%22);%0A            data = $.parseData(document.body, %22data-null%22);%0A            expect(data).eq(null);%0A            document.body.setAttribute(%22data-num%22,%2220120429%22);%0A            data = $.parseData(document.body, %22data-num%22);%0A            expect(data).eq(20120429);%0A        %7D%0A%0A    %7D);%0A%7D);%0A//2012.4.29 %E6%B7%BB%E5%8A%A0$.parseData%E6%B5%8B%E8%AF%95

添加$.parseData测试