Skip to content

Commit

Permalink
feat: use scoped nativescript packages (#589)
Browse files Browse the repository at this point in the history
* chore: upgrade the samples to NS 6.2

* feat: use the new NPM scoped packages of NS 6.2

* feat: more changes to NS 6.2 NPM scoped packages
  • Loading branch information
msaelices authored and rigor789 committed Nov 29, 2019
1 parent 14a34bc commit 121c11d
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 100 deletions.
2 changes: 1 addition & 1 deletion __tests__/renderer/ViewNode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.mock('renderer/utils', () => ({
insertChild: jest.fn(),
removeChild: jest.fn()
}))
jest.mock('tns-core-modules/platform', () => {
jest.mock('@nativescript/core/platform', () => {
return {
isAndroid() {
},
Expand Down
22 changes: 11 additions & 11 deletions __tests__/renderer/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as utils from 'renderer/utils'

jest.mock('tns-core-modules/ui/core/view', () => {
jest.mock('@nativescript/core/ui/core/view', () => {
return {
View() {
}
}
}, {virtual: true})
jest.mock('tns-core-modules/ui/content-view', () => {
jest.mock('@nativescript/core/ui/content-view', () => {
return {
ContentView() {
}
}
}, {virtual: true})
jest.mock('tns-core-modules/ui/layouts/layout-base', () => {
jest.mock('@nativescript/core/ui/layouts/layout-base', () => {
return {
LayoutBase() {
}
Expand All @@ -34,7 +34,7 @@ const getParentAndChild = (parentType) => {

describe('utils', () => {
test('isView', () => {
const View = require('tns-core-modules/ui/core/view').View;
const View = require('@nativescript/core/ui/core/view').View;

expect(utils.isView()).toEqual(false)
expect(utils.isView('a')).toEqual(false)
Expand All @@ -43,7 +43,7 @@ describe('utils', () => {
})

test('isLayout', () => {
const LayoutBase = require('tns-core-modules/ui/layouts/layout-base').LayoutBase;
const LayoutBase = require('@nativescript/core/ui/layouts/layout-base').LayoutBase;

expect(utils.isLayout()).toEqual(false)
expect(utils.isLayout('a')).toEqual(false)
Expand All @@ -52,7 +52,7 @@ describe('utils', () => {
})

test('isContentView', () => {
const ContentView = require('tns-core-modules/ui/content-view').ContentView;
const ContentView = require('@nativescript/core/ui/content-view').ContentView;

expect(utils.isContentView()).toEqual(false)
expect(utils.isContentView('a')).toEqual(false)
Expand All @@ -73,7 +73,7 @@ describe('utils', () => {


test('insertChild adds childNode to Layout parent', () => {
const LayoutBase = require('tns-core-modules/ui/layouts/layout-base').LayoutBase;
const LayoutBase = require('@nativescript/core/ui/layouts/layout-base').LayoutBase;
const {parentNode, childNode} = getParentAndChild(LayoutBase);
parentNode.nativeView.addChild = jest.fn();
childNode.nativeView.parent = null;
Expand All @@ -84,7 +84,7 @@ describe('utils', () => {


test('insertChild adds childNode at index to Layout parent', () => {
const LayoutBase = require('tns-core-modules/ui/layouts/layout-base').LayoutBase;
const LayoutBase = require('@nativescript/core/ui/layouts/layout-base').LayoutBase;
const {parentNode, childNode} = getParentAndChild(LayoutBase);
parentNode.nativeView.insertChild = jest.fn();
childNode.nativeView.parent = null;
Expand All @@ -94,7 +94,7 @@ describe('utils', () => {
})

test('insertChild removes childNode if the parent is the same Layout parent', () => {
const LayoutBase = require('tns-core-modules/ui/layouts/layout-base').LayoutBase;
const LayoutBase = require('@nativescript/core/ui/layouts/layout-base').LayoutBase;
const {parentNode, childNode} = getParentAndChild(LayoutBase);
parentNode.nativeView.getChildIndex = jest.fn().mockReturnValueOnce(1).mockReturnValueOnce(-1);
parentNode.nativeView.removeChild = jest.fn();
Expand All @@ -112,7 +112,7 @@ describe('utils', () => {
})

test('insertChild adds comment node to ContentView parent', () => {
const ContentView = require('tns-core-modules/ui/content-view').ContentView;
const ContentView = require('@nativescript/core/ui/content-view').ContentView;
const {parentNode, childNode} = getParentAndChild(ContentView);
childNode.nodeType = 8;
parentNode.nativeView._addView = jest.fn();
Expand All @@ -122,7 +122,7 @@ describe('utils', () => {
})

test('insertChild sets content of ContentView parent', () => {
const ContentView = require('tns-core-modules/ui/content-view').ContentView;
const ContentView = require('@nativescript/core/ui/content-view').ContentView;
const {parentNode, childNode} = getParentAndChild(ContentView);

utils.insertChild(parentNode, childNode);
Expand Down
2 changes: 1 addition & 1 deletion build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const builds = {
banner: banner('NativeScript-Vue'),
intro,
external(id) {
return id.startsWith('tns-core-modules') || id.startsWith('weex')
return id.startsWith('@nativescript') || id.startsWith('tns-core-modules') || id.startsWith('weex')
},
},
'nativescript-vue-template-compiler': {
Expand Down
Loading

0 comments on commit 121c11d

Please sign in to comment.