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


TypeScript exports.customTag_define函数代码示例

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


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

示例1: UTest

import { customTag_define } from '@core/custom/exports'
import { Compo } from '@compo/exports'

UTest({
	'attributes': {
		'components' : {
			'should use parent as `this` in expressions' () {
				customTag_define('Foo', Compo({
					myNum: 5
				}));
		        customTag_define('Bar', Compo({
		        	myNum: 7
		        }));
		        var compo = Compo.initialize('Bar > Foo test=~[this.myNum] > div test="~[this.myNum]"');
		        var foo = compo.find('Foo');
		        is_(foo.attr.test, 'Number');
		        eq_(foo.attr.test, 7);

		        var divAttrVal = compo.$.filter('div').attr('test');
		        is_(divAttrVal, 'String');
		        eq_(divAttrVal, '5');
			}
		}
	}
})
开发者ID:atmajs,项目名称:MaskJS,代码行数:25,代码来源:interpolations.spec.ts

示例2: mask_config

		`);
		
		mask_config('getFile', null);
		deepEq_(_queue, ['MyComponents.mask', 'MyLetter.mask']);

		await UTest.domtest(dom, `
			find ('h1') > text ('B');
		`);	
	},
	'should load async javascripts scope' (done) {
		customTag_define('TestAsync', Compo.create({
			onRenderStart () {
				var x = this.$scope('X');
				eq_(x, null, 'Scope should be empty, while still loading');

				setTimeout(() => {
					x = this.$scope('X');
					has_(x, { foo: { name: 'Foo1' }});
					done();
				}, 300);
			}
		}));
		renderer_render(`
			import async * as X from '/test/tmpl/modules/data_foo_1.js';
			TestAsync;
		`);
	},
	'should await the component': {
		'simple await' (done) {
			customTag_define('TestAsync', Compo({
				onRenderStart () {
					var x = this.$scope('X');
开发者ID:atmajs,项目名称:MaskJS,代码行数:32,代码来源:async.spec.ts

示例3: customTag_get

					h4 > 'FooFromTmpl'
				}
			`)
			
			var compo = customTag_get('FooFromTmpl');
			is_(compo, 'Function');
			
			var dom = renderer_render('FooFromTmpl');
			return UTest.domtest(dom, `
				find('h4') > text FooFromTmpl;	
			`);
		},
		'let' () {
			'> create owner component'
			var Foo = Compo({});
			customTag_define('Foo', Foo);
			
			'> register from template in the owners scope'
			customTag_registerFromTemplate(`
				let LetBaz {
					h4 > 'LetBaz'
				}
			`, Foo);
			
			listeners_on('error', assert.await(error => has_(error.message, 'LetBaz')));
			var dom = renderer_render(`
				Foo {
					LetBaz;
				}
				LetBaz;
			`);
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:register.spec.ts

示例4: renderer_render

			var dom = renderer_render(template, { name: 'Hello'});
			$(dom)
				.filter('h4')
				.eq_('length', 1)
				.eq_('text', 'HELLO');
		},
		'... for arguments' () {
			var template = `
				define Foo (user) {

					function testFn () {
						return user.name;
					}
				}
			`;
			customTag_define(template);
			var Wrapper = Compo.initialize('Foo (bob)', { bob: { name: 'IBob'}});
			var Foo = Wrapper.find('Foo');
			eq_(Foo.testFn(), 'IBob');
		},
		'// (should be implemented: binding and setter problem)... for variables' () {
			var template = `
				define Foo {
					var WIDTH = 10 / 2;

					function onRenderStart () {
						this.width = WIDTH;
					}
				}
			`;
开发者ID:atmajs,项目名称:MaskJS,代码行数:30,代码来源:methods-define.spec.ts

示例5: deepEq_

	'should map tree': {
		'should map nodes tree' () {
			var ast = mask_TreeWalker.map(parser_parse('div > span'), node => {
				return { tagName: node.tagName.toUpperCase() };
			});
			deepEq_(ast, {
				tagName: 'DIV',
				nodes: [
					{ tagName: 'SPAN' }
				]
			});
		},
		'should map components tree' () {
			customTag_define('Foo', Compo({
				serialize () {
					return 'iFoo'
				},
			}));
			customTag_define('Bar', Compo({
				serialize () {
					return 'iBar'
				}
			}));
			var root = Compo.initialize('Foo > Bar');
			var foo = Compo.find(root, 'Foo');
			var tree = mask_TreeWalker.map(foo, compo => {
				return { text: compo.serialize() };
			});
			deepEq_(tree, {
				text: 'iFoo',
				components: [
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:TreeWalker.spec.ts

示例6: UTest

import { customTag_define } from '@core/custom/exports'
import { Compo } from '@compo/exports'
import '@core/feature/methods/exports'
import '@core/feature/modules/exports'

declare var sinon;

UTest({
	'slot should be private (do not pass the signal to parent)' () {
		var parentFn = sinon.spy();
		customTag_define('FooParent', Compo({
			slots: {
				test: parentFn
			} 
		}));
		customTag_define(`
			define Foo {

				var called = false;

				slot private test () {
					this.scope.called = true;
				}

				button x-click=test;
			}
		`);

        var compo = Compo.initialize('FooParent > Foo');        
		return UTest
			.domtest(compo.$, `
开发者ID:atmajs,项目名称:MaskJS,代码行数:31,代码来源:define-methods.spec.ts


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