mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Added template and config for main runner.
This commit is contained in:
42
Gruntfile.js
42
Gruntfile.js
@@ -47,7 +47,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
// Browser versions
|
||||
browser: {
|
||||
src: ['<%= build.browser %>'],
|
||||
src: ['<%= !build.browser %>'],
|
||||
dest: 'test/browser/less.js'
|
||||
},
|
||||
alpha: {
|
||||
@@ -115,6 +115,38 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
|
||||
connect: {
|
||||
server: {
|
||||
options: {
|
||||
port: 8081
|
||||
// grunt-contrib-jasmine assumes that web-server runs in root directory
|
||||
// it 's outfile is relativized against root
|
||||
//base: 'test'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
jasmine: {
|
||||
options: {
|
||||
keepRunner: true, //TODO meri: remove after it is done
|
||||
host: 'http://localhost:8081/',
|
||||
helpers: 'test/browser/common.js',
|
||||
template: 'test/browser/test-runner-template.tmpl'
|
||||
},
|
||||
main: {
|
||||
//TODO meri: find better location for less.js - reference can go to template and compiled browser to dist
|
||||
//src is used to build list of less files to compile
|
||||
src: ['test/less/*.less', '!test/less/javascript.less', '!test/less/urls.less'],
|
||||
options: {
|
||||
specs: 'test/browser/runner-main.js',
|
||||
outfile: 'test/browser/test-runner-main.html',
|
||||
templateOptions: {
|
||||
originalLess: '',
|
||||
expectedCss: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Before running tests, clean out the results
|
||||
// of any previous tests. (this will need to be
|
||||
// setup based on configuration of browser tests.
|
||||
@@ -162,11 +194,17 @@ module.exports = function(grunt) {
|
||||
'uglify:beta'
|
||||
]);
|
||||
|
||||
// Run all tests
|
||||
grunt.registerTask('browserTest', [
|
||||
'connect:server',
|
||||
]);
|
||||
|
||||
// Run all tests
|
||||
grunt.registerTask('test', [
|
||||
'jshint:lib',
|
||||
'clean',
|
||||
'shell:test'
|
||||
'shell:test',
|
||||
'browserTest'
|
||||
// 'shell:browser',
|
||||
// 'shell:phantom'
|
||||
]);
|
||||
|
||||
24
dist/less-1.4.2.min.js
vendored
24
dist/less-1.4.2.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -123,4 +123,4 @@ var loadFile = function(href) {
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
41
test/browser/test-runner-template.tmpl
Normal file
41
test/browser/test-runner-template.tmpl
Normal file
@@ -0,0 +1,41 @@
|
||||
<!doctype html>
|
||||
<%
|
||||
var generateScriptsTasgs = function(allScripts) {
|
||||
allScripts.forEach(function(script){ %> <script src="<%= script %>"></script>
|
||||
<% });
|
||||
};
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Jasmine Spec Runner</title>
|
||||
|
||||
<!-- less and css links -->
|
||||
<%
|
||||
scripts.src.forEach(function(fullLessName) {
|
||||
var pathParts = fullLessName.split('/'),
|
||||
fullCssName = fullLessName.replace(/less/g, 'css'),
|
||||
lessName = pathParts[pathParts.length-1],
|
||||
name = lessName.split('.')[0];
|
||||
%>
|
||||
<link id="original-less:test-less-<%=name%>" rel="stylesheet/less" type="text/css" href="<%=fullLessName%>">
|
||||
<link id="expected-less:test-less-<%=name%>" rel="stylesheet" type="text/css" href="<%=fullCssName%>"><%
|
||||
});
|
||||
%>
|
||||
|
||||
<!-- grunt-contrib-jasmine css -->
|
||||
<% css.forEach(function(style){ %>
|
||||
<link rel="stylesheet" type="text/css" href="<%= style %>">
|
||||
<% }) %>
|
||||
<!-- inital grunt-contrib-jasmine scripts -->
|
||||
<% generateScriptsTasgs([].concat(scripts.polyfills, scripts.jasmine)); %>
|
||||
<!-- less.js testing -->
|
||||
<% generateScriptsTasgs(scripts.vendor);
|
||||
%> <script>var less = { async: false, strictMath: true };</script><script src="less.js"></script>
|
||||
<% generateScriptsTasgs([].concat(scripts.helpers, scripts.specs)); %>
|
||||
<!-- final grunt-contrib-jasmine scripts -->
|
||||
<% generateScriptsTasgs([].concat(scripts.reporters, scripts.start)); %>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user