-
Notifications
You must be signed in to change notification settings - Fork 2k
/
index.html
144 lines (131 loc) · 5.51 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mocha Tests</title>
<link rel="stylesheet" href="vendor/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<div id="fixture" style="position: absolute; top: -9999px; left: -9999px"></div>
<!-- Test Runner -->
<script src="./vendor/sinon.js"></script>
<script src="./vendor/mocha.js"></script>
<script src="./vendor/chai.js"></script>
<script>
mocha.setup('bdd');
var assert = chai.assert;
// Export sinon.assert methods onto assert.
sinon.assert.expose(assert, {prefix: ''});
var ckan = {ENV: 'testing'};
</script>
<!-- Source -->
<script src="../vendor/jed.js"></script>
<script src="../vendor/jquery.js"></script>
<script src="../vendor/bootstrap/js/bootstrap.js"></script>
<script src="../javascript/plugins/jquery.inherit.js"></script>
<script src="../javascript/plugins/jquery.proxy-all.js"></script>
<script src="../javascript/plugins/jquery.url-helpers.js"></script>
<script src="../javascript/plugins/jquery.date-helpers.js"></script>
<script src="../javascript/plugins/jquery.slug.js"></script>
<script src="../javascript/plugins/jquery.slug-preview.js"></script>
<script src="../javascript/plugins/jquery.form-warning.js"></script>
<script src="../javascript/sandbox.js"></script>
<script src="../javascript/module.js"></script>
<script src="../javascript/pubsub.js"></script>
<script src="../javascript/client.js"></script>
<script src="../javascript/notify.js"></script>
<script src="../javascript/i18n.js"></script>
<script src="../javascript/main.js"></script>
<script src="../javascript/view-filters.js"></script>
<script src="../javascript/modules/basic-form.js"></script>
<script src="../javascript/modules/autocomplete.js"></script>
<script src="../javascript/modules/resource-form.js"></script>
<script src="../javascript/modules/resource-upload-field.js"></script>
<script src="../javascript/modules/confirm-action.js"></script>
<script src="../javascript/modules/custom-fields.js"></script>
<!-- Suite -->
<script src="./spec/ckan.spec.js"></script>
<script src="./spec/module.spec.js"></script>
<script src="./spec/sandbox.spec.js"></script>
<script src="./spec/client.spec.js"></script>
<script src="./spec/pubsub.spec.js"></script>
<script src="./spec/notify.spec.js"></script>
<script src="./spec/view-filters.spec.js"></script>
<script src="./spec/modules/resource-form.spec.js"></script>
<script src="./spec/modules/resource-upload-field.spec.js"></script>
<script src="./spec/modules/confirm-action.spec.js"></script>
<script src="./spec/modules/basic-form.spec.js"></script>
<script src="./spec/modules/autocomplete.spec.js"></script>
<script src="./spec/modules/custom-fields.spec.js"></script>
<script src="./spec/plugins/jquery.inherit.spec.js"></script>
<script src="./spec/plugins/jquery.proxy-all.spec.js"></script>
<script src="./spec/plugins/jquery.url-helpers.spec.js"></script>
<script src="./spec/plugins/jquery.date-helpers.spec.js"></script>
<script src="./spec/plugins/jquery.slug.spec.js"></script>
<script src="./spec/plugins/jquery.slug-preview.spec.js"></script>
<script src="./spec/plugins/jquery.form-warning.spec.js"></script>
<script>
/* Helper function for loading snippets from the ajax_snippets directory.
* The filename should be provided and an optional object of query
* string parameters. The returned snippet will be loaded into the
* fixture and passed to any callback.
*
* The callback shares the same scope as the rest of the suite so you
* can assign test variables easily. It is passed the loaded HTML string
* and the fixture element.
*
* filename - The snippet filename to load.
* params - An optional object of query string params.
* callback - An optional callback to call when loaded.
*
* Example:
*
* // To simply load a fixture.
* beforeEach(function (done) {
* this.loadFixture('my-snippet', done);
* });
*
* // To get the html itself.
* beforeEach(function (done) {
* this.loadFixture('my-snippet', function (html) {
* this.template = html;
* done();
* });
* });
*
*/
function loadFixture(filename, params, callback) {
var context = this;
// Allow function to be called without params.
if (typeof params === 'function') {
callback = params;
params = {};
}
return (new ckan.Client()).getTemplate(filename, params).fail(function () {
throw new Error('Unable to load fixture: ' + filename);
}).pipe(function (template) {
var fixture = jQuery('#fixture').html(template);
callback && callback.call(context, template, fixture);
return template;
});
}
before(function () {
// Assign the loadFixture helper. Callbacks will have the same scope
// as the before() functions.
this.loadFixture = jQuery.proxy(loadFixture, this);
});
beforeEach(function () {
this.fixture = jQuery('#fixture').empty();
});
afterEach(function () {
this.fixture.empty();
});
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
</script>
</body>
</html>