• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript exports.customTag_define函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript exports.customTag_get函数代码示例发布时间:2022-05-28
下一篇:
TypeScript exports.customAttr_register函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap