More preparations for qunit testing.
This commit is contained in:
parent
fe52d5fcd2
commit
d86059b811
@ -2571,6 +2571,10 @@
|
||||
val = Conf[key];
|
||||
Conf[key] = $.get(key, val);
|
||||
}
|
||||
if (QUnit) {
|
||||
Main.initQUnit();
|
||||
return;
|
||||
}
|
||||
pathname = location.pathname.split('/');
|
||||
g.BOARD = new Board(pathname[1]);
|
||||
if (g.REPLY = pathname[2] === 'res') {
|
||||
@ -2595,6 +2599,36 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
initQUnit: function() {
|
||||
window.x = {
|
||||
UI: UI,
|
||||
$: $,
|
||||
Board: Board,
|
||||
Thread: Thread,
|
||||
Post: Post,
|
||||
Main: Main,
|
||||
Redirect: Redirect,
|
||||
Build: Build,
|
||||
Get: Get,
|
||||
Quotify: Quotify,
|
||||
QuoteInline: QuoteInline,
|
||||
QuotePreview: QuotePreview,
|
||||
QuoteBacklink: QuoteBacklink,
|
||||
QuoteOP: QuoteOP,
|
||||
QuoteCT: QuoteCT,
|
||||
Anonymize: Anonymize,
|
||||
Time: Time,
|
||||
FileInfo: FileInfo,
|
||||
Sauce: Sauce,
|
||||
RevealSpoilers: RevealSpoilers,
|
||||
AutoGIF: AutoGIF,
|
||||
ImageHover: ImageHover,
|
||||
ThreadUpdater: ThreadUpdater
|
||||
};
|
||||
g.BOARD = new Board('a');
|
||||
g.REPLY = true;
|
||||
return g.THREAD = '123456789';
|
||||
},
|
||||
initHeader: function() {
|
||||
$.addStyle(Main.css);
|
||||
Main.header = $.el('div', {
|
||||
|
||||
17
grunt.js
17
grunt.js
@ -24,7 +24,7 @@ module.exports = function(grunt) {
|
||||
],
|
||||
dest: 'tmp/script.coffee'
|
||||
},
|
||||
js: {
|
||||
script: {
|
||||
src: ['<file_template:src/metadata.js>', '<file_template:src/banner.js>', 'tmp/script.js'],
|
||||
dest: '<config:meta.files.userjs>'
|
||||
},
|
||||
@ -38,7 +38,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
coffee: {
|
||||
all: {
|
||||
script: {
|
||||
src: 'tmp/script.coffee',
|
||||
dest: 'tmp/script.js'
|
||||
}
|
||||
@ -46,14 +46,15 @@ module.exports = function(grunt) {
|
||||
exec: {
|
||||
commit: {
|
||||
command: function(grunt) {
|
||||
var name, version;
|
||||
var name, release, version;
|
||||
name = grunt.config(['pkg', 'name']).replace(/-/g, ' ');
|
||||
version = grunt.config(['pkg', 'version']);
|
||||
release = name + ' v' + version;
|
||||
return [
|
||||
'git checkout master',
|
||||
'git commit -am "Release ' + name + ' v' + version + '."',
|
||||
'git tag -a ' + version + ' -m "' + version + '"',
|
||||
'git tag -af stable -m "' + version + '"'
|
||||
'git commit -am "Release ' + release + '."',
|
||||
'git tag -a ' + version + ' -m "' + release + '"',
|
||||
'git tag -af stable -m "' + release + '"'
|
||||
].join(' && ');
|
||||
},
|
||||
stdout: true
|
||||
@ -91,10 +92,10 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee');
|
||||
grunt.loadNpmTasks('grunt-exec');
|
||||
|
||||
grunt.registerTask('default', 'concat:coffee coffee concat:js clean');
|
||||
grunt.registerTask('default', 'concat:coffee coffee:script concat:script clean');
|
||||
grunt.registerTask('release', 'concat:meta concat:latest default exec:commit exec:push');
|
||||
grunt.registerTask('patch', 'bump');
|
||||
grunt.registerTask('upgrade', 'bump:minor');
|
||||
grunt.registerTask('test', 'server qunit');
|
||||
grunt.registerTask('test', 'default server qunit');
|
||||
|
||||
};
|
||||
|
||||
@ -266,6 +266,10 @@ Main =
|
||||
for key, val of Conf
|
||||
Conf[key] = $.get key, val
|
||||
|
||||
if QUnit
|
||||
Main.initQUnit()
|
||||
return
|
||||
|
||||
pathname = location.pathname.split '/'
|
||||
g.BOARD = new Board pathname[1]
|
||||
if g.REPLY = pathname[2] is 'res'
|
||||
@ -285,6 +289,39 @@ Main =
|
||||
location.href = url if url
|
||||
return
|
||||
|
||||
initQUnit: ->
|
||||
window.x =
|
||||
# ui.coffee
|
||||
UI: UI
|
||||
# $.coffee
|
||||
$: $
|
||||
# main.coffee
|
||||
Board: Board
|
||||
Thread: Thread
|
||||
Post: Post
|
||||
Main: Main
|
||||
# features.coffee
|
||||
Redirect: Redirect
|
||||
Build: Build
|
||||
Get: Get
|
||||
Quotify: Quotify
|
||||
QuoteInline: QuoteInline
|
||||
QuotePreview: QuotePreview
|
||||
QuoteBacklink: QuoteBacklink
|
||||
QuoteOP: QuoteOP
|
||||
QuoteCT: QuoteCT
|
||||
Anonymize: Anonymize
|
||||
Time: Time
|
||||
FileInfo: FileInfo
|
||||
Sauce: Sauce
|
||||
RevealSpoilers: RevealSpoilers
|
||||
AutoGIF: AutoGIF
|
||||
ImageHover: ImageHover
|
||||
ThreadUpdater: ThreadUpdater
|
||||
g.BOARD = new Board 'a'
|
||||
g.REPLY = true
|
||||
g.THREAD = '123456789'
|
||||
|
||||
initHeader: ->
|
||||
$.addStyle Main.css
|
||||
Main.header = $.el 'div',
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
<body>
|
||||
<div id='qunit'></div>
|
||||
<script src='../node_modules/qunitjs/qunit/qunit.js'></script>
|
||||
<script src='../4chan_x.user.js'></script>
|
||||
<script>
|
||||
module('test module');
|
||||
test('test', function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user