日期:2014-05-16 浏览次数:20335 次
StartTest(function(t) { t.diag("Extjs common test"); t.ok(Ext,"Ext is here"); Ext.define("test.Talk", { talk:function() { return 'talk' } } ); Ext.define("test.Person", { mixins: { everyOneNeedTalk:"test.Talk" } }); var p = Ext.create("test.Person"); t.is('talk',p.talk(),'The method is mixin') Ext.define("test.Student",{ config:{ gender:'boy' }, constructor:function(config){ this.initConfig(config); //这里需要调用initConfig,否则不会自动生成getter 和 setter } }); var s = Ext.create('test.Student') t.is(s.getGender(),'boy','generate getter') s.setGender('girl'); t.is(s.getGender(),'girl','generate setter') t.done(); // Optional, marks the correct exit point from the test });