当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript assert.ok函数代码示例

本文整理汇总了TypeScript中vs/base/common/assert.ok函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ok函数的具体用法?TypeScript ok怎么用?TypeScript ok使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ok函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: worked

	/**
	 * Tells the progress bar that an amount of work has been completed.
	 */
	public worked(value: number): ProgressBar {
		assert.ok(!isNaN(this.totalWork), 'Total work not set');

		value = Number(value);
		assert.ok(!isNaN(value), 'Value is not a number');
		value = Math.max(1, value);

		this.workedVal += value;
		this.workedVal = Math.min(this.totalWork, this.workedVal);

		if (this.element.hasClass(css_infinite)) {
			this.element.removeClass(css_infinite);
		}

		if (this.element.hasClass(css_done)) {
			this.element.removeClass(css_done);
		}

		if (!this.element.hasClass(css_active)) {
			this.element.addClass(css_active);
		}

		if (!this.element.hasClass(css_discrete)) {
			this.element.addClass(css_discrete);
		}

		this.bit.style.width = 100 * (this.workedVal / this.totalWork) + '%';

		return this;
	}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:33,代码来源:progressbar.ts

示例2: doSetWorked

	private doSetWorked(value: number): ProgressBar {
		assert.ok(!isNaN(this.totalWork), 'Total work not set');

		this.workedVal = value;
		this.workedVal = Math.min(this.totalWork, this.workedVal);

		if (hasClass(this.element, css_infinite)) {
			removeClass(this.element, css_infinite);
		}

		if (hasClass(this.element, css_done)) {
			removeClass(this.element, css_done);
		}

		if (!hasClass(this.element, css_active)) {
			addClass(this.element, css_active);
		}

		if (!hasClass(this.element, css_discrete)) {
			addClass(this.element, css_discrete);
		}

		this.bit.style.width = 100 * (this.workedVal / this.totalWork) + '%';

		return this;
	}
开发者ID:developers23,项目名称:vscode,代码行数:26,代码来源:progressbar.ts

示例3: setWorked

	/**
	 * Tells the progress bar the total amount of work that has been completed.
	 */
	setWorked(value: number): ProgressBar {
		value = Number(value);
		assert.ok(!isNaN(value), 'Value is not a number');
		value = Math.max(1, value);

		return this.doSetWorked(value);
	}
开发者ID:developers23,项目名称:vscode,代码行数:10,代码来源:progressbar.ts

示例4: test

	test('ok', function () {
		assert.throws(function () {
			ok(false);
		});

		assert.throws(function () {
			ok(null);
		});

		assert.throws(function () {
			ok();
		});

		assert.throws(function () {
			ok(null, 'Foo Bar');
		}, function (e: Error) {
			return e.message.indexOf('Foo Bar') >= 0;
		});

		ok(true);
		ok('foo');
		ok({});
		ok(5);
	});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:24,代码来源:assert.test.ts

示例5: test

	test("ok", function () {
		assert.throws(function () {
			ok(false);
		});

		assert.throws(function () {
			ok(null);
		});

		assert.throws(function () {
			ok();
		});

		assert.throws(function () {
			ok(null, "Foo Bar");
		}, function(e) {
			return e.message.indexOf("Foo Bar") >= 0;
		});

		ok(true);
		ok("foo");
		ok({});
		ok(5);
	});
开发者ID:1424667164,项目名称:vscode,代码行数:24,代码来源:assert.test.ts

示例6: ok

		assert.throws(function () {
			ok(null, 'Foo Bar');
		}, function (e: Error) {
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:3,代码来源:assert.test.ts

示例7: ok

		assert.throws(function () {
			ok(null, "Foo Bar");
		}, function(e) {
开发者ID:1424667164,项目名称:vscode,代码行数:3,代码来源:assert.test.ts


注:本文中的vs/base/common/assert.ok函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。