mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
test(all): adds more asserts
This commit is contained in:
@ -167,8 +167,7 @@ export class Content extends Ion {
|
|||||||
) {
|
) {
|
||||||
super(config, elementRef, renderer);
|
super(config, elementRef, renderer);
|
||||||
|
|
||||||
this._mode = config.get('mode');
|
this._setMode('content', config.get('mode'));
|
||||||
this._setMode('content', this._mode);
|
|
||||||
|
|
||||||
this._sbPadding = config.getBoolean('statusbarPadding', false);
|
this._sbPadding = config.getBoolean('statusbarPadding', false);
|
||||||
|
|
||||||
@ -496,7 +495,7 @@ export class Content extends Ion {
|
|||||||
|
|
||||||
let ele: HTMLElement = this._elementRef.nativeElement;
|
let ele: HTMLElement = this._elementRef.nativeElement;
|
||||||
if (!ele) {
|
if (!ele) {
|
||||||
assert(true, 'ele should be valid');
|
assert(false, 'ele should be valid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,13 +550,13 @@ export class Content extends Ion {
|
|||||||
writeDimensions() {
|
writeDimensions() {
|
||||||
let scrollEle = this._scrollEle as any;
|
let scrollEle = this._scrollEle as any;
|
||||||
if (!scrollEle) {
|
if (!scrollEle) {
|
||||||
assert(true, 'this._scrollEle should be valid');
|
assert(false, 'this._scrollEle should be valid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let fixedEle = this._fixedEle;
|
let fixedEle = this._fixedEle;
|
||||||
if (!fixedEle) {
|
if (!fixedEle) {
|
||||||
assert(true, 'this._fixedEle should be valid');
|
assert(false, 'this._fixedEle should be valid');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,13 +607,13 @@ export class Content extends Ion {
|
|||||||
this.contentBottom = contentBottom;
|
this.contentBottom = contentBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this._tabsPlacement !== null && this._tabs) {
|
if (this._tabsPlacement !== null && this._tabs) {
|
||||||
// set the position of the tabbar
|
// set the position of the tabbar
|
||||||
if (this._tabsPlacement === 'top') {
|
if (this._tabsPlacement === 'top') {
|
||||||
this._tabs.setTabbarPosition(this._headerHeight, -1);
|
this._tabs.setTabbarPosition(this._headerHeight, -1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
assert(this._tabsPlacement === 'bottom', 'tabsPlacement should be bottom');
|
||||||
this._tabs.setTabbarPosition(-1, 0);
|
this._tabs.setTabbarPosition(-1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ export class ItemSliding {
|
|||||||
case ItemSideFlags.Right: openAmount = Math.max(0, openAmount); break;
|
case ItemSideFlags.Right: openAmount = Math.max(0, openAmount); break;
|
||||||
case ItemSideFlags.Left: openAmount = Math.min(0, openAmount); break;
|
case ItemSideFlags.Left: openAmount = Math.min(0, openAmount); break;
|
||||||
case ItemSideFlags.Both: break;
|
case ItemSideFlags.Both: break;
|
||||||
default: assert(true, 'invalid ItemSideFlags value'); break;
|
default: assert(false, 'invalid ItemSideFlags value'); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (openAmount > this._optsWidthRightSide) {
|
if (openAmount > this._optsWidthRightSide) {
|
||||||
|
@ -165,6 +165,7 @@ function _assert(actual: any, reason?: string) {
|
|||||||
if (!actual && ASSERT_ENABLED === true) {
|
if (!actual && ASSERT_ENABLED === true) {
|
||||||
let message = 'IONIC ASSERT: ' + reason;
|
let message = 'IONIC ASSERT: ' + reason;
|
||||||
console.error(message);
|
console.error(message);
|
||||||
|
debugger; // tslint:disable-line
|
||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user