當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。