Skip to content

Commit

Permalink
Merge pull request #273 from bitovi/canjs-to-3.0
Browse files Browse the repository at this point in the history
Upgrade to CanJS 3.0, Steal 0.16
  • Loading branch information
chasenlehara authored Jul 27, 2017
2 parents b15ea52 + 8d15b51 commit 42f0b67
Show file tree
Hide file tree
Showing 23 changed files with 513 additions and 410 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "node"
- 4
- 6
- 8
script: npm test
sudo: false
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Test against this version of Node.js
environment:
matrix:
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "6"

# Install scripts. (runs after repo cloning)
install:
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/components/tabs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import can from 'can/';
import CanComponent from 'can-component';
import tabsStache from './tabs.stache!';
/**
* @module {function} components/tabs/ <tabs>
Expand All @@ -7,7 +7,7 @@ import tabsStache from './tabs.stache!';
* @signature `<tabs>`
* Creates a tabs component.
*/
export default can.Component.extend({
export default CanComponent.extend({
tag: "tabs",
template: tabsStache,
scope: { ... }
Expand Down
62 changes: 34 additions & 28 deletions lib/configured/configured_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe("lib/configured", function(){
done(e)
} else {
configured.getProject({
source: "git:/bitovi/canjs#minor",
source: "git:/canjs/canjs#master",
path: path.join(__dirname,"test","tmp","canjs"),
npmInstall: ["stealjs/steal#master"]
}).then(function(){
Expand All @@ -122,7 +122,7 @@ describe("lib/configured", function(){


it(".geneateProject is able to read the documentjs.json without versions and build a site", function(done){
this.timeout(10000);
this.timeout(30000);
rmdir(path.join(__dirname,"test","api"), function(e){
if(e) {
done(e);
Expand All @@ -141,7 +141,7 @@ describe("lib/configured", function(){
});

it(".geneateProject is able to take a docObject instead of reading one", function(done){
this.timeout(10000);
this.timeout(30000);
rmdir(path.join(__dirname,"test","tmp","example_project"), function(e){
if(e) {
done(e);
Expand Down Expand Up @@ -176,15 +176,17 @@ describe("lib/configured", function(){
open("test/tmp/multiple_versions/1.0.0/api/index.html",function(browser, close){
var select = browser.window.document.getElementsByTagName("select")[0],
$ = browser.window.$;
$(select).val("3.0.0").trigger("change");

waitFor(browser, function(window){
return window.location.href == "http://localhost:8081/test/tmp/multiple_versions/3.0.0/api/index.html"
}, function(){
assert.ok(true,"updated page");
close();
next();
}, close);
$(select).val("3.0.0");
select.dispatchEvent(new browser.window.Event('change'));

waitFor(browser, function(window){
return window.location.href == "http://localhost:8081/test/tmp/multiple_versions/3.0.0/api/index.html"
}, function(){
assert.ok(true,"updated page");
close();
next();
}, close);

},done);
};
Expand All @@ -193,15 +195,17 @@ describe("lib/configured", function(){
open("test/tmp/multiple_versions/api/index.html",function(browser, close){
var select = browser.window.document.getElementsByTagName("select")[0],
$ = browser.window.$;
$(select).val("3.0.0").trigger("change");

waitFor(browser, function(window){
return window.location.href == "http://localhost:8081/test/tmp/multiple_versions/3.0.0/api/index.html"
}, function(){
assert.ok(true,"updated page");
close();
next();
}, close);
$(select).val("3.0.0");
select.dispatchEvent(new browser.window.Event('change'));

waitFor(browser, function(window){
return window.location.href == "http://localhost:8081/test/tmp/multiple_versions/3.0.0/api/index.html"
}, function(){
assert.ok(true,"updated page");
close();
next();
}, close);

},done);
};
Expand All @@ -210,15 +214,17 @@ describe("lib/configured", function(){
open("test/tmp/multiple_versions/3.0.0/api/index.html",function(browser, close){
var select = browser.window.document.getElementsByTagName("select")[0],
$ = browser.window.$;
$(select).val("2.0.0").trigger("change");

waitFor(browser, function(window){
return window.location.href == "http://localhost:8081/test/tmp/multiple_versions/api/index.html"
}, function(){
assert.ok(true,"updated page");
close();
next();
}, close);
$(select).val("2.0.0");
select.dispatchEvent(new browser.window.Event('change'));

waitFor(browser, function(window){
return window.location.href == "http://localhost:8081/test/tmp/multiple_versions/api/index.html"
}, function(){
assert.ok(true,"updated page");
close();
next();
}, close);

},done);
};
Expand Down Expand Up @@ -258,7 +264,7 @@ describe("lib/configured", function(){


it(".generateProject is able to build something without a documentjs.json", function(done){
this.timeout(10000);
this.timeout(30000);
rmdir(path.join(__dirname,"test","docs"), function(e){
if(e) {
done(e);
Expand Down
3 changes: 2 additions & 1 deletion lib/generate/test/generate_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var open = function(url, callback, done){
describe("documentjs/lib/generate/generate",function(){

it("works",function(done){
this.timeout(30000);
this.timeout(10000);
rmdir(__dirname+"/out",function(error){

generate({
Expand All @@ -62,6 +62,7 @@ describe("documentjs/lib/generate/generate",function(){
});

it("@outline works", function(done){
this.timeout(30000);
generate({
glob: __dirname+"/example/*.js",
dest: __dirname+"/out",
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/html/html_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("documentjs/lib/generators/html",function(){
}, options));
});
html.generate(docMap,options).then(function(){
if(!fs.existsSync(path.join(__dirname,"test","tmp","static","can","can.js"))) {
if(!fs.existsSync(path.join(__dirname,"test","tmp","static","can-control","can-control.js"))) {
done(new Error("canjs does not exist"));
} else if(fs.existsSync(path.join(__dirname,"test","tmp","static","bundles","static.js"))) {
done(new Error("static build exists"));
Expand Down
2 changes: 1 addition & 1 deletion lib/tags/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var _default = require("./_default"),
* /**
* * @alias WidgetFactory
* *|
* can.Class.extend("jQuery.Controller",
* CanClass.extend("jQuery.Controller",
* ...
* @codeend
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/tags/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var tnd = require('./helpers/typeNameDescription')
* /**
* * @function
* * @deprecated {1.0} This method has been replaced
* * by [can.Model.parseModel].
* * by [CanModel.parseModel].
* *
* * @param {String} name
* *|
Expand Down
48 changes: 24 additions & 24 deletions lib/tags/helpers/typer_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ var typer = require("./typer"),
describe("documentjs/tags/helpers/typer", function(){

it("name",function(){
assert.deepEqual( typer.type("can.Control"), {
assert.deepEqual( typer.type("CanControl"), {
types: [{
type: "can.Control"
type: "CanControl"
}]
});
});
Expand Down Expand Up @@ -43,11 +43,11 @@ describe("documentjs/tags/helpers/typer", function(){
});

it("union",function(){
assert.deepEqual( typer.type("(can.Control|can.Model)"), {
assert.deepEqual( typer.type("(CanControl|CanModel)"), {
types: [{
type: "can.Control"
type: "CanControl"
},{
type: "can.Model"
type: "CanModel"
}]
});
});
Expand All @@ -67,16 +67,16 @@ describe("documentjs/tags/helpers/typer", function(){
});

it("nullable",function(){
assert.deepEqual( typer.type("?can.Control"), {
assert.deepEqual( typer.type("?CanControl"), {
types: [{
type: "can.Control"
type: "CanControl"
}],
nullable: true
});

assert.deepEqual( typer.type("?can.Control"), {
assert.deepEqual( typer.type("?CanControl"), {
types: [{
type: "can.Control"
type: "CanControl"
}],
nullable: true
});
Expand All @@ -85,9 +85,9 @@ describe("documentjs/tags/helpers/typer", function(){


it("nonnullable",function(){
assert.deepEqual( typer.type("!can.Control"), {
assert.deepEqual( typer.type("!CanControl"), {
types: [{
type: "can.Control"
type: "CanControl"
}],
nonnull: true
});
Expand Down Expand Up @@ -123,18 +123,18 @@ describe("documentjs/tags/helpers/typer", function(){
});

it("variable params",function(){
assert.deepEqual( typer.type("...can.Control"), {
assert.deepEqual( typer.type("...CanControl"), {
types: [{
type: "can.Control"
type: "CanControl"
}],
variable: true
});
})

it("variable params",function(){
assert.deepEqual( typer.type("...can.Control"), {
assert.deepEqual( typer.type("...CanControl"), {
types: [{
type: "can.Control"
type: "CanControl"
}],
variable: true
});
Expand All @@ -143,14 +143,14 @@ describe("documentjs/tags/helpers/typer", function(){

it("variable params",function(){

assert.deepEqual( typer.type("function(...can.Observe){}"), {
assert.deepEqual( typer.type("function(...CanObserve){}"), {
types: [{
type: "function",
constructs: undefined,
context: undefined,
returns: {types: [{type: "undefined"}]},
params: [
{types: [{type: "can.Observe"}], variable: true}
{types: [{type: "CanObserve"}], variable: true}
]
}],
});
Expand All @@ -159,9 +159,9 @@ describe("documentjs/tags/helpers/typer", function(){

// NON-STANDARD types ...
it("optional",function(){
assert.deepEqual( typer.type("can.Control="), {
assert.deepEqual( typer.type("CanControl="), {
types: [{
type: "can.Control"
type: "CanControl"
}],
optional: true
});
Expand All @@ -178,17 +178,17 @@ describe("documentjs/tags/helpers/typer", function(){
});

it("parenthesis-less union", function(){
assert.deepEqual( typer.type("can.Control|can.Model"), {
assert.deepEqual( typer.type("CanControl|CanModel"), {
types: [{
type: "can.Control"
type: "CanControl"
},{
type: "can.Model"
type: "CanModel"
}]
});
})

it("parenthesis-less union with function", function(){
assert.deepEqual( typer.type("function|can.Model"), {
assert.deepEqual( typer.type("function|CanModel"), {
types: [{
type: "function",
type: "function",
Expand All @@ -197,7 +197,7 @@ describe("documentjs/tags/helpers/typer", function(){
returns: {types: [{type: "undefined"}]},
params: []
},{
type: "can.Model"
type: "CanModel"
}]
});
});
Expand Down
4 changes: 2 additions & 2 deletions lib/tags/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*
* @codestart
* /**
* * @@page can.Construct.super
* * @@parent can.Construct.plugins
* * @@page CanConstruct.super
* * @@parent CanConstruct.plugins
* * @@plugin can/construct/super
* * @@test can/construct/super/qunit.html
* *|
Expand Down
6 changes: 3 additions & 3 deletions lib/tags/property_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe("documentjs/lib/tags/property",function(){

var obj = {};
var docMap = {Foo: {name: "Foo", type: "constructor"}}
property.add.call(obj,"@property {can.Map|Object|function} bar a description",null,docMap.Foo, docMap );
option.add.call(obj,"@option {can.Map} can.Map description");
property.add.call(obj,"@property {CanMap|Object|function} bar a description",null,docMap.Foo, docMap );
option.add.call(obj,"@option {CanMap} CanMap description");
option.add.call(obj,"@option {Object} Object description");
option.add.call(obj,"@option {function(String)} Function description");

Expand All @@ -37,7 +37,7 @@ describe("documentjs/lib/tags/property",function(){
name: "Foo.bar",
type: "property",
types: [
{type: "can.Map", description: "can.Map description"},
{type: "CanMap", description: "CanMap description"},
{type: "Object", description: "Object description", options: []},
{
constructs: undefined,
Expand Down
4 changes: 2 additions & 2 deletions lib/tags/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* @codestart javascript
* /**
* * Capitalizes a string.
* * @@signature `can.capitalize(s)` Example:
* * @@signature `CanCapitalize(s)` Example:
* *
* * can.capitalize("foo") //-> "Bar"
* * CanCapitalize("foo") //-> "Bar"
* *
* * @@param {String} s the string to be lowercased.
* * @@return {String} a string with the first character capitalized,
Expand Down
Loading

0 comments on commit 42f0b67

Please sign in to comment.