steps toward test driver working

This commit is contained in:
David Greenspan
2013-07-01 19:54:09 -07:00
parent 21ed1bdbe0
commit 7bfa8b9c88
3 changed files with 23 additions and 9 deletions

View File

@@ -13,7 +13,7 @@ Package.on_use(function (api) {
api.use('session');
api.use(['spark', 'livedata', 'templating', 'deps'], 'client');
api.use(['ui', 'livedata', 'deps'], 'client');
api.add_files([
'driver.css',

View File

@@ -565,6 +565,10 @@ _.extend(Component.prototype, {
result = If;
} else if (id === 'each') {
result = Each;
} else if (id === 'unless') {
result = Unless;
} else if (id === 'with') {
result = Component;
} else if (id in global) {
result = global[id];
thisToBind = self.getData();

View File

@@ -1,14 +1,24 @@
// @export If
If = Component.extend({
init: function () {
if (! this.getArg('content'))
throw new Error("If requires content");
},
render: function (buf) {
if (this.getArg('data'))
buf.component(this.getArg('content').create());
else if (this.getArg('elseContent'))
buf.component(this.getArg('elseContent'));
if (this.getArg('data')) {
if (this.getArg('content'))
buf.component(this.getArg('content').create());
} else if (this.getArg('elseContent')) {
buf.component(this.getArg('elseContent').create());
}
}
});
// @export Unless
Unless = Component.extend({
render: function (buf) {
if (! this.getArg('data')) {
if (this.getArg('content'))
buf.component(this.getArg('content').create());
} else if (this.getArg('elseContent')) {
buf.component(this.getArg('elseContent').create());
}
}
});