Skip to content

Commit

Permalink
fixed ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed May 17, 2017
1 parent 4640f10 commit 443c21d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
10 changes: 7 additions & 3 deletions packages/wepy/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,23 @@ export default {
config[name] = app.constructor.prototype[name];
});

// config.$app = app;
if (arguments.length === 2 && arguments[1] === true) {
config.$app = app;
}
app.$wxapp = getApp();
return config;
},
$createPage (pageClass, pagePath) {
let self = this;
let config = {}, k;
let page = new pageClass();
if (pagePath)
if (typeof pagePath === 'string') {
this.$instance.$pages[pagePath] = page;
}
page.initMixins();
// This will be a circum Object
// config.$page = page;
if ((typeof pagePath === 'boolean' && pagePath) || (arguments.length === 3 && arguments[2] === true))
config.$page = page;

config.onLoad = function (...args) {

Expand Down
2 changes: 1 addition & 1 deletion packages/wepy/test/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ wxfake.resetGlobal();
describe('app.js', () => {


let appConfig = wepy.$createApp(App);
let appConfig = wepy.$createApp(App, true);
let app = appConfig.$app;


Expand Down
4 changes: 2 additions & 2 deletions packages/wepy/test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ describe('base.js', () => {
it('create app', () => {
wxfake.resetGlobal();

let config = wepy.$createApp(App);
let config = wepy.$createApp(App, true);

assert.strictEqual(typeof config.custom, 'function', 'return a app object');
});

it('create page', () => {
let page = wepy.$createPage(Index);
let page = wepy.$createPage(Index, true);

page.onLoad.call(wxfake.getWxPage());

Expand Down
8 changes: 4 additions & 4 deletions packages/wepy/test/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('component.js', () => {

wxfake.resetGlobal();

let appConfig = wepy.$createApp(App);
let pageConfig = wepy.$createPage(Index);
let appConfig = wepy.$createApp(App, true);
let pageConfig = wepy.$createPage(Index, true);
pageConfig.onLoad.call(wxfake.getWxPage());


Expand Down Expand Up @@ -171,8 +171,8 @@ describe('component.js', () => {
});

it('$invoke', () => {
let appConfig = wepy.$createApp(App);
let pageConfig = wepy.$createPage(Index);
let appConfig = wepy.$createApp(App, true);
let pageConfig = wepy.$createPage(Index, true);

let page = pageConfig.$page;
let app = appConfig.$app;
Expand Down
4 changes: 2 additions & 2 deletions packages/wepy/test/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ describe('mixin.js', () => {


it('mixin function', () => {
let appConfig = wepy.$createApp(App);
let pageConfig = wepy.$createPage(Index);
let appConfig = wepy.$createApp(App, true);
let pageConfig = wepy.$createPage(Index, true);

let page = pageConfig.$page;
let app = appConfig.$app;
Expand Down
11 changes: 5 additions & 6 deletions packages/wepy/test/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ var Page2 = require('./fake/page2');
var App = require('./fake/app');


let appConfig = wepy.$createApp(App);
let appConfig = wepy.$createApp(App, true);
wepy.$instance = appConfig.$app;

let pageConfig = wepy.$createPage(Index, 'pages/page1');
let page2Config = wepy.$createPage(Page2, 'pages/page2');

let pageConfig = wepy.$createPage(Index, 'pages/page1', true);
let page2Config = wepy.$createPage(Page2, 'pages/page2', true);
let page = pageConfig.$page;
let app = appConfig.$app;

Expand Down Expand Up @@ -67,13 +66,13 @@ describe('page.js', () => {

assert.strictEqual(page instanceof Index, true, 'create a page instance');

assert.strictEqual(page.isComponent, false, 'page is not a component');
assert.strictEqual(page.$isComponent, false, 'page is not a component');

});


it('props', () => {
let pageConfig = wepy.$createPage(Index);
let pageConfig = wepy.$createPage(Index, true);
let page = pageConfig.$page;

pageConfig.onLoad.call(wxfake.getWxPage());
Expand Down

0 comments on commit 443c21d

Please sign in to comment.