Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #6447: fix type checking for primitive wrapper objects #6450

Merged
merged 4 commits into from
Sep 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build/release-weex.sh
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
cd -

# commit
git add src/entries/weex*
git add packages/weex*
git commit -m "[release] weex-vue-framework@$NEXT_VERSION"
fi
1,146 changes: 928 additions & 218 deletions packages/weex-template-compiler/build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/weex-template-compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weex-template-compiler",
"version": "2.1.9-weex.1",
"version": "2.4.2-weex.1",
"description": "Weex template compiler for Vue 2.0",
"main": "index.js",
"repository": {
692 changes: 506 additions & 186 deletions packages/weex-vue-framework/factory.js

Large diffs are not rendered by default.

287 changes: 174 additions & 113 deletions packages/weex-vue-framework/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/weex-vue-framework/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weex-vue-framework",
"version": "2.1.9-weex.1",
"version": "2.4.2-weex.1",
"description": "Vue 2.0 Framework for Weex",
"main": "index.js",
"repository": {
2 changes: 1 addition & 1 deletion src/core/util/env.js
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ export const isAndroid = UA && UA.indexOf('android') > 0
export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge

// Firefix has a "watch" function on Object.prototype...
// Firefox has a "watch" function on Object.prototype...
export const nativeWatch = ({}).watch

export let supportsPassive = false
7 changes: 6 additions & 1 deletion src/core/util/props.js
Original file line number Diff line number Diff line change
@@ -145,7 +145,12 @@ function assertType (value: any, type: Function): {
let valid
const expectedType = getType(type)
if (simpleCheckRE.test(expectedType)) {
valid = typeof value === expectedType.toLowerCase()
const t = typeof value
valid = t === expectedType.toLowerCase()
// for primitive wrapper objects
if (!valid && t === 'object') {
valid = value instanceof type
}
} else if (expectedType === 'Object') {
valid = isPlainObject(value)
} else if (expectedType === 'Array') {
11 changes: 11 additions & 0 deletions test/unit/features/options/props.spec.js
Original file line number Diff line number Diff line change
@@ -206,6 +206,17 @@ describe('Options props', () => {
expect('Expected Array').toHaveBeenWarned()
})

it('primitive wrapper objects', () => {
/* eslint-disable no-new-wrappers */
makeInstance(new String('s'), String)
expect(console.error.calls.count()).toBe(0)
makeInstance(new Number(1), Number)
expect(console.error.calls.count()).toBe(0)
makeInstance(new Boolean(true), Boolean)
expect(console.error.calls.count()).toBe(0)
/* eslint-enable no-new-wrappers */
})

if (hasSymbol) {
it('symbol', () => {
makeInstance(Symbol('foo'), Symbol)