aboutsummaryrefslogtreecommitdiffstats
path: root/docs/spec/domSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-01-25 21:55:11 -0800
committerIgor Minar2011-01-26 23:31:15 -0800
commitbd33f60276a0fa37acffbad7a0cdcff92db594c8 (patch)
tree7cd957c19182ddc430a6320b77b2f03cb1bd223d /docs/spec/domSpec.js
parent8682befc7284a3c0b35cd5d85d4f42b1484ec71a (diff)
downloadangular.js-bd33f60276a0fa37acffbad7a0cdcff92db594c8.tar.bz2
Added part of guide documentation and supporting changes to doc generator
Diffstat (limited to 'docs/spec/domSpec.js')
-rw-r--r--docs/spec/domSpec.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/docs/spec/domSpec.js b/docs/spec/domSpec.js
index 58063789..f9308ed6 100644
--- a/docs/spec/domSpec.js
+++ b/docs/spec/domSpec.js
@@ -1,9 +1,14 @@
var DOM = require('dom.js').DOM;
describe('dom', function(){
+ var dom;
+
+ beforeEach(function(){
+ dom = new DOM();
+ });
+
describe('example', function(){
it('should render code, live, test', function(){
- var dom = new DOM();
dom.example('desc', 'src', 'scenario');
expect(dom.toString()).toEqual(
'<h1>Example</h1>\n' +
@@ -15,7 +20,6 @@ describe('dom', function(){
});
it('should render non-live, test with description', function(){
- var dom = new DOM();
dom.example('desc', 'src', false);
expect(dom.toString()).toEqual('<h1>Example</h1>\n' +
'<div class="example">' +
@@ -26,10 +30,32 @@ describe('dom', function(){
});
it('should render non-live, test', function(){
- var dom = new DOM();
dom.example('desc', 'src', false);
expect(dom.toString()).toContain('<pre class="brush: js; html-script: true;">src</pre>');
});
+ });
+
+ describe('h', function(){
+
+ it('should render using function', function(){
+ var cbThis;
+ var cdValue;
+ dom.h('heading', 'content', function(value){
+ cbThis = this;
+ cbValue = value;
+ });
+ expect(cbThis).toEqual(dom);
+ expect(cbValue).toEqual('content');
+ });
+
+ it('should update heading numbers', function(){
+ dom.h('heading', function(){
+ this.html('<h1>sub-heading</h1>');
+ });
+ expect(dom.toString()).toContain('<h1>heading</h1>');
+ expect(dom.toString()).toContain('<h2>sub-heading</h2>');
+ });
});
+
});