Skip to content

Commit

Permalink
Add specs for compiling module
Browse files Browse the repository at this point in the history
  • Loading branch information
lifesinger committed Jan 27, 2013
1 parent 7d4d86f commit 32a1476
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 82 deletions.
2 changes: 0 additions & 2 deletions tests/issues/combo-use/combo.js

This file was deleted.

43 changes: 0 additions & 43 deletions tests/issues/combo-use/test.html

This file was deleted.

26 changes: 0 additions & 26 deletions tests/issues/compiling-module/test.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ define(function(require) {
Animal.prototype.isAnimal = true
return Animal

})
});

Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ define(function(require) {
Dog.prototype.isDog = true
return Dog

})
});

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(function(require) {

var test = require('../../test')
var test = require('../../../test')

var Dog = require('./dog')
var dog = new Dog()
Expand All @@ -10,8 +10,9 @@ define(function(require) {
test.assert(dog.isAnimal === true, dog.isAnimal)
test.assert(dog.isDog === true, dog.isDog)
test.assert(dog.__filename === 'dog.js', dog.__filename)
test.assert(dog.__module.dependencies.length === 2, dog.__module.dependencies)
test.assert(dog.__module.dependencies.length === 2, dog.__module.dependencies.length)

test.done()
test.next()

});

})
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
define(function(require, exports, mod) {
(function() {

var Module = mod.constructor
var compilingStack = Module.compilingStack
var compilingStack = []

seajs.on('compile', function(mod) {
compilingStack.push(mod)
})

seajs.on('compiled', function() {
compilingStack.pop()
})


define(function(require, exports) {

exports.inherits = function(ctor, superCtor) {

ctor.prototype = createProto(superCtor.prototype)

// Adds meta info
// Add meta info
var compilingModule = compilingStack[compilingStack.length - 1]
var filename = compilingModule.uri.split(/[\/\\]/).pop()

Expand All @@ -25,7 +34,7 @@ define(function(require, exports, mod) {
}


// Shared empty constructor function to aid in prototype-chain creation.
// Shared empty constructor function to aid in prototype-chain creation
function Ctor() {
}

Expand All @@ -40,3 +49,6 @@ define(function(require, exports, mod) {
}

})

})();

1 change: 1 addition & 0 deletions tests/specs/extensible/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
test.run([
'specs/extensible/auto-transport',
'specs/extensible/combo-map',
'specs/extensible/compiling-module',
'specs/extensible/module-constructor'
])
})
Expand Down

0 comments on commit 32a1476

Please sign in to comment.