-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90dba9b
commit bb63e5f
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
npm-debug.log | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,9 @@ | |
"bugs": { | ||
"url" : "https://github.com/devotis/node-extjs-custom/issues", | ||
"email" : "[email protected]" | ||
}, | ||
"devDependencies": { | ||
"mocha": "2.0.x", | ||
"should": "4.3.x" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var should = require('should'); | ||
|
||
var Ext = require('../Ext'); | ||
Ext.Template = require('../Template'); | ||
Ext.XTemplate = require('../XTemplate'); | ||
|
||
var data = { | ||
name: 'Don Griffin', | ||
title: 'Senior Technomage', | ||
company: 'Sencha Inc.', | ||
drinks: ['Coffee', 'Water', 'More Coffee'], | ||
kids: [ | ||
{ name: 'Aubrey', age: 17 }, | ||
{ name: 'Joshua', age: 13 }, | ||
{ name: 'Cale', age: 10 }, | ||
{ name: 'Nikol', age: 5 }, | ||
{ name: 'Solomon', age: 0 } | ||
] | ||
}; | ||
|
||
describe('Template', function() { | ||
it('basic compiling should work', function() { | ||
var tpl = new Ext.Template('Name: {0}, Age: {1}'); | ||
var html = tpl.apply(['John', 25]); | ||
html.should.be.a.String.and.be.equal('Name: John, Age: 25') | ||
}); | ||
}); | ||
|
||
describe('XTemplate', function() { | ||
it('basic compiling should work', function() { | ||
var tpl = new Ext.XTemplate( | ||
'<p>Name: {name}</p>', | ||
'<p>Title: {title}</p>', | ||
'<p>Company: {company}</p>', | ||
'<p>Kids: ', | ||
'<tpl for="kids">', // interrogate the kids property within the data | ||
'<p>{name}</p>', | ||
'</tpl></p>' | ||
); | ||
|
||
var html = tpl.apply(data); | ||
html.should.be.a.String.and.be.equal('<p>Name: Don Griffin</p><p>Title: Senior Technomage</p><p>Company: Sencha Inc.</p><p>Kids: <tpl for="kids"><p>Don Griffin</p></tpl></p>') | ||
}); | ||
}); | ||
|