當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript inferno.render函數代碼示例

本文整理匯總了TypeScript中inferno.render函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript render函數的具體用法?TypeScript render怎麽用?TypeScript render使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了render函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: render

			() => render(template('Hello', {}, ' and ', 'Zoo'), container)
開發者ID:Keats,項目名稱:inferno,代碼行數:1,代碼來源:update.spec.browser.ts

示例2: it

	it('should insert to the middle', () => {
		render(template(generateNodes(['c', 'd', 'e'])), container);
		render(template(generateNodes(['a', 'b', 'e'])), container);
		expect(container.textContent).to.equal('abe');
		expect(container.firstChild.childNodes.length).to.equal(3);
	});
開發者ID:Keats,項目名稱:inferno,代碼行數:6,代碼來源:patchNonKeyedChildren.spec.browser.ts

示例3: afterEach

	afterEach(() => {
		render(null, container);
		container.innerHTML = '';
		document.body.removeChild(container);
	});
開發者ID:Keats,項目名稱:inferno,代碼行數:5,代碼來源:createElement.spec.browser.ts

示例4: it

	it('should render a basic component', () => {
		let template = (Component, title) =>
			createElement('div', null,
				createElement(Component, {
					title,
					name: 'basic-render'
				})
			);

		expect(() => {
			render(template(null, 'abc'), container);
		}).to.throw();

		expect(() => {
			render(template({}, 'abc'), container);
		}).to.throw();

		render(template(BasicComponent1, 'abc'), container);

		expect(container.firstChild.firstChild.getAttribute('class')).to.equal('basic');
		expect(container.firstChild.firstChild.firstChild.getAttribute('class')).to.equal('basic-render');
		expect(container.firstChild.firstChild.tagName).to.equal('DIV');
		expect(container.firstChild.firstChild.firstChild.tagName).to.equal('SPAN');
		expect(container.firstChild.firstChild.firstChild.innerHTML).to.equal('The title is abc');

		expect(() => {
			render(template({}, 'abc'), container);
		}).to.throw();

		expect(() => render(template(BasicComponent1, {}), container)).to.throw;

		render(template(BasicComponent1, []), container);

		render(template(BasicComponent1, 'abcdef'), container);

		expect(container.firstChild.firstChild.getAttribute('class')).to.equal('basic');
		expect(container.firstChild.firstChild.firstChild.getAttribute('class')).to.equal('basic-render');
		expect(container.firstChild.firstChild.tagName).to.equal('DIV');
		expect(container.firstChild.firstChild.firstChild.tagName).to.equal('SPAN');
		expect(container.firstChild.firstChild.firstChild.innerHTML).to.equal('The title is abcdef');

		render(template(BasicComponent1, null), container);

		expect(container.firstChild.firstChild.getAttribute('class')).to.equal('basic');
		expect(container.firstChild.firstChild.firstChild.getAttribute('class')).to.equal('basic-render');
		expect(container.firstChild.firstChild.tagName).to.equal('DIV');
		expect(container.firstChild.firstChild.firstChild.tagName).to.equal('SPAN');
		expect(container.firstChild.firstChild.firstChild.innerHTML).to.equal('The title is ');

		render(template(BasicComponent1, undefined), container);

		expect(container.firstChild.firstChild.getAttribute('class')).to.equal('basic');
		expect(container.firstChild.firstChild.firstChild.getAttribute('class')).to.equal('basic-render');
		expect(container.firstChild.firstChild.tagName).to.equal('DIV');
		expect(container.firstChild.firstChild.firstChild.tagName).to.equal('SPAN');
		expect(container.firstChild.firstChild.firstChild.innerHTML).to.equal('The title is ');

		render(template(BasicComponent1, '1234'), container);

		expect(container.firstChild.firstChild.getAttribute('class')).to.equal('basic');
		expect(container.firstChild.firstChild.firstChild.getAttribute('class')).to.equal('basic-render');
		expect(container.firstChild.firstChild.tagName).to.equal('DIV');
		expect(container.firstChild.firstChild.firstChild.tagName).to.equal('SPAN');
		expect(container.firstChild.firstChild.firstChild.innerHTML).to.equal('The title is 1234');
	});
開發者ID:Keats,項目名稱:inferno,代碼行數:65,代碼來源:components.spec.browser.ts

示例5: unmountComponentAtNode

function unmountComponentAtNode(
  container: Element | SVGAElement | DocumentFragment
): boolean {
  render(null, container);
  return true;
}
開發者ID:russelgal,項目名稱:inferno,代碼行數:6,代碼來源:index.ts

示例6: it

			it('Second render (update)', () => {
				render(template(null), container); // change style to null

				expect(container.firstChild.firstChild.getAttribute('style')).to.be.oneOf([null, '']);
			});
開發者ID:Keats,項目名稱:inferno,代碼行數:5,代碼來源:update.spec.browser.ts

示例7: afterEach

		afterEach(() => {
			render(null, container);
		});
開發者ID:Keats,項目名稱:inferno,代碼行數:3,代碼來源:hooks.spec.browser.ts


注:本文中的inferno.render函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。