mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
var BrowserHelpers = require('./util/BrowserHelpers');
|
|
|
|
if (typeof window !== 'undefined') {
|
|
describe('marko-components deprecated (browser)', function() {
|
|
require('./util/autotest').runTests(
|
|
require('./autotests/components-browser-deprecated/autotests.tests'),
|
|
function run(testFunc, done) {
|
|
var helpers = new BrowserHelpers();
|
|
|
|
require('marko/jquery').patchComponent(window.$);
|
|
require('marko/ready').patchComponent();
|
|
|
|
function cleanup() {
|
|
delete require('marko/components/Component').prototype.$;
|
|
delete require('marko/components/Component').prototype.ready;
|
|
}
|
|
|
|
try {
|
|
if (testFunc.length === 1) {
|
|
testFunc(helpers);
|
|
helpers._cleanup();
|
|
cleanup();
|
|
done();
|
|
} else {
|
|
testFunc(helpers, function(err) {
|
|
helpers._cleanup();
|
|
cleanup();
|
|
done(err);
|
|
});
|
|
}
|
|
} catch(e) {
|
|
cleanup();
|
|
throw e;
|
|
}
|
|
|
|
});
|
|
});
|
|
} |