doc(ng:view): fix broken template links in docs; add scenario test.

This commit is contained in:
Misko Hevery 2011-07-18 10:42:42 -07:00
parent fdd5d9471f
commit 0cf5535333

View file

@ -1261,9 +1261,12 @@ angularWidget("@ng:non-bindable", noop);
<doc:source> <doc:source>
<script> <script>
function MyCtrl($route) { function MyCtrl($route) {
$route.when('/overview', {controller: OverviewCtrl, template: 'guide.overview.html'}); $route.when('/overview',
$route.when('/bootstrap', {controller: BootstrapCtrl, template: 'guide.bootstrap.html'}); { controller: OverviewCtrl,
console.log(window.$route = $route); template: 'guide/dev_guide.overview.html'});
$route.when('/bootstrap',
{ controller: BootstrapCtrl,
template: 'guide/dev_guide.bootstrap.auto_bootstrap.html'});
}; };
MyCtrl.$inject = ['$route']; MyCtrl.$inject = ['$route'];
@ -1271,13 +1274,25 @@ angularWidget("@ng:non-bindable", noop);
function OverviewCtrl(){} function OverviewCtrl(){}
</script> </script>
<div ng:controller="MyCtrl"> <div ng:controller="MyCtrl">
<a href="#/overview">overview</a> | <a href="#/bootstrap">bootstrap</a> | <a href="#/undefined">undefined</a><br/> <a href="#/overview">overview</a> |
<a href="#/bootstrap">bootstrap</a> |
<a href="#/undefined">undefined</a>
<br/>
The view is included below: The view is included below:
<hr/> <hr/>
<ng:view></ng:view> <ng:view></ng:view>
</div> </div>
</doc:source> </doc:source>
<doc:scenario> <doc:scenario>
it('should load templates', function(){
element('.doc-example-live a:contains(overview)').click();
expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Overview/);
element('.doc-example-live a:contains(bootstrap)').click();
expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Initializing Angular: Automatic Initiialization/);
});
</doc:scenario> </doc:scenario>
</doc:example> </doc:example>
*/ */