~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/yui/tests/querystring/tests/io-querystring.html

  • Committer: Evan Dandrea
  • Date: 2012-05-09 05:53:45 UTC
  • Revision ID: evan.dandrea@canonical.com-20120509055345-z2j41tmcbf4as5uf
The backend now lives in lp:daisy and the website (errors.ubuntu.com) now lives in lp:errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html>
3
 
<head>
4
 
    <title>Test Page</title>
5
 
    <link rel="stylesheet" href="../../../build/test/assets/test-console.css">
6
 
    <style>
7
 
    body {
8
 
        font-size:16px;
9
 
    }
10
 
    script.mine {
11
 
        clear:left;
12
 
        white-space:pre;
13
 
        display:block;
14
 
        font-family:monospace;
15
 
        background:#eef;
16
 
    }
17
 
    script::before, script::after {
18
 
        content:"<script>";
19
 
    }
20
 
    script::after {
21
 
        content:"</script>";
22
 
    }
23
 
    script[src]::before {
24
 
        content:"<script src=\"" attr(src) "\">";
25
 
        white-space:nowrap;
26
 
    }
27
 
    script[src] {
28
 
        background:#fff;
29
 
    }
30
 
    .yui-console, .yui-console-bd {
31
 
        height:auto!important;
32
 
        overflow:auto!important;
33
 
        overflow-y:auto!important;
34
 
    }
35
 
 
36
 
    </style>
37
 
</head>
38
 
<body class="yui3-skin-sam">
39
 
<h1>Query String Tests</h1>
40
 
 
41
 
<p>Tests running...</p>
42
 
 
43
 
<script src="../../../build/yui/yui.js"></script>
44
 
<script>
45
 
 
46
 
var DATA1 = {
47
 
            foo : "bar",
48
 
            baz : { quux : "foo" }
49
 
        },
50
 
        DATA2 = {
51
 
            foo : "bar",
52
 
            baz : { quux : "foo" },
53
 
            arr : [1,2,3]
54
 
        };
55
 
 
56
 
function verify (expected) {
57
 
    return function (_, o) {
58
 
        var actual = o.responseText;
59
 
 
60
 
        if (actual !== expected) {
61
 
                throw new Error("Expected: "+expected+"\nActual: "+actual);
62
 
        }
63
 
 
64
 
        document.body.appendChild(document.createElement("pre")).innerHTML =
65
 
            "Success! " + expected;
66
 
    };
67
 
};
68
 
 
69
 
 
70
 
YUI({ filter : 'raw' }).use( 'querystring-stringify-simple', 'io-base', function (Y) {
71
 
    Y.io("./test.php?simple_qs", {
72
 
        method : "POST",
73
 
        data : DATA1,
74
 
        on : {
75
 
            success : verify('{"POST":{"foo":"bar","baz":"[object Object]"},"GET":{"simple_qs":""}}')
76
 
        }
77
 
    });
78
 
});
79
 
 
80
 
YUI({ filter : 'raw' }).use( 'querystring', 'io-base', function (Y) {
81
 
    Y.io("./test.php?with_qs", {
82
 
        method : "POST",
83
 
        data : DATA2,
84
 
        on : {
85
 
            success : verify('{"POST":{"foo":"bar","baz":{"quux":"foo"},"arr":["1","2","3"]},"GET":{"with_qs":""}}')
86
 
        }
87
 
    });
88
 
 
89
 
});
90
 
</script>
91
 
</body>
92
 
</html>