Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

Commit

Permalink
new template build
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Remeika committed Jan 24, 2012
1 parent 01ea955 commit 56bb607
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 10 deletions.
44 changes: 39 additions & 5 deletions templates/browser-node/foounit/foounit.js
Expand Up @@ -806,9 +806,7 @@ foounit.mixin(foounit.Example.prototype, {
this._descriptions = descriptions;
}

, getBefores: function (){
return this._befores;
}
, getBefores: function (){ return this._befores; }

, setAfters: function (afters){
this._afters = afters;
Expand All @@ -821,10 +819,15 @@ foounit.mixin(foounit.Example.prototype, {
, getTest: function (){
return this._test;
}

, setStatus: function (code){
this._status = code;
}
});
foounit.ExampleGroup = function (description, builder){
foounit.ExampleGroup = function (description, builder, pending){
this._description = description;
this._builder = builder;
this._pending = pending;
this._before = null;
this._after = null;
this._examples = [];
Expand All @@ -841,10 +844,16 @@ foounit.mixin(foounit.ExampleGroup.prototype, {
}

, addExample: function (example){
if (this.isPending()){
example.setStatus(foounit.Example.prototype.PENDING);
}
this._examples.push(example);
}

, addGroup: function (group){
if (this.isPending()){
group.setPending(true);
}
this._groups.push(group);
}

Expand All @@ -871,6 +880,14 @@ foounit.mixin(foounit.ExampleGroup.prototype, {
, getDescription: function (){
return this._description;
}

, isPending: function (){
return this._pending;
}

, setPending: function (bool){
this._pending = bool;
}
});
foounit.Expectation = function (actual){
this._actual = actual;
Expand Down Expand Up @@ -930,7 +947,6 @@ foounit.addKeyword('after', function (func){
group.setAfter(func);
});


/**
* Defines a group in the BuildContext
*/
Expand All @@ -946,6 +962,24 @@ foounit.addKeyword('describe', function (description, builder){
context.setCurrentGroup(parentGroup);
});

/*
* Defines a pending group in the BuildContext.
* All examples and nested groups within this group will
* be marked as pending.
*/
foounit.addKeyword('xdescribe', function (description, builder){
var context = foounit.getBuildContext()
, parentGroup = context.getCurrentGroup()
, group = new foounit.ExampleGroup(description, builder, true);

parentGroup.addGroup(group);

context.setCurrentGroup(group);
group.build();
context.setCurrentGroup(parentGroup);
return group;
});

/**
* Creates a foounit.Expectation
*/
Expand Down
44 changes: 39 additions & 5 deletions templates/browser/foounit/foounit.js
Expand Up @@ -806,9 +806,7 @@ foounit.mixin(foounit.Example.prototype, {
this._descriptions = descriptions;
}

, getBefores: function (){
return this._befores;
}
, getBefores: function (){ return this._befores; }

, setAfters: function (afters){
this._afters = afters;
Expand All @@ -821,10 +819,15 @@ foounit.mixin(foounit.Example.prototype, {
, getTest: function (){
return this._test;
}

, setStatus: function (code){
this._status = code;
}
});
foounit.ExampleGroup = function (description, builder){
foounit.ExampleGroup = function (description, builder, pending){
this._description = description;
this._builder = builder;
this._pending = pending;
this._before = null;
this._after = null;
this._examples = [];
Expand All @@ -841,10 +844,16 @@ foounit.mixin(foounit.ExampleGroup.prototype, {
}

, addExample: function (example){
if (this.isPending()){
example.setStatus(foounit.Example.prototype.PENDING);
}
this._examples.push(example);
}

, addGroup: function (group){
if (this.isPending()){
group.setPending(true);
}
this._groups.push(group);
}

Expand All @@ -871,6 +880,14 @@ foounit.mixin(foounit.ExampleGroup.prototype, {
, getDescription: function (){
return this._description;
}

, isPending: function (){
return this._pending;
}

, setPending: function (bool){
this._pending = bool;
}
});
foounit.Expectation = function (actual){
this._actual = actual;
Expand Down Expand Up @@ -930,7 +947,6 @@ foounit.addKeyword('after', function (func){
group.setAfter(func);
});


/**
* Defines a group in the BuildContext
*/
Expand All @@ -946,6 +962,24 @@ foounit.addKeyword('describe', function (description, builder){
context.setCurrentGroup(parentGroup);
});

/*
* Defines a pending group in the BuildContext.
* All examples and nested groups within this group will
* be marked as pending.
*/
foounit.addKeyword('xdescribe', function (description, builder){
var context = foounit.getBuildContext()
, parentGroup = context.getCurrentGroup()
, group = new foounit.ExampleGroup(description, builder, true);

parentGroup.addGroup(group);

context.setCurrentGroup(group);
group.build();
context.setCurrentGroup(parentGroup);
return group;
});

/**
* Creates a foounit.Expectation
*/
Expand Down

0 comments on commit 56bb607

Please sign in to comment.