Skip to content
Myr

Merge branch 'integration'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parents b8833f4, 54865eb · Browse files · 9 files+99 added−36 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+99 added−36 removed

  • tests:+95 added−35 removed
  • other:+4 added−1 removed

9 files+99 added−36 removed

added:examples/hello-world/views/partials/greeting.html.ejs+1 added
1Welcome back, <strong><%= name %></strong>!
modified:examples/hello-world/views/front.html.ejs+1 added
1<h1><%= title %></h1>2<%= this.partial("greeting.html.ejs", { locals: { name: name } }) %>3<% if (items && items.length) { %>4 <ul>5 <% for (var i = 0; i < items.length; ++i) { %>6 <li><%= items[i] %></li>
3 unmodified lines
modified:examples/hello-world/app.js+1 added
modified:lib/support/ejs/lib/ejs.js+1 added-1 removed
added:spec/fixtures/partials/article.html.ejs+9 added
1<ul>2 <% if (__isFirst__) { %>3 <li class="first"><%= article %></li>4 <% } else if (__isLast__) { %>5 <li class="last"><%= article %></li>6 <% } else { %>7 <li class="<%= __index__ %>"><%= article %></li>8 <% } %>9</ul>
added:spec/fixtures/partials/item.html.ejs+1 added
1<li><%= item %></li>
added:spec/fixtures/partials/video.html.ejs+1 added
1<li><%= vid %></li>
added:spec/fixtures/list.html.ejs+5 added
1<ul>2 <% for (var i in items) { %>3 <%= this.partial("item.html.ejs", { locals: { item: items[i] }}) %>4 <% } %>5</ul>
modified:spec/spec.plugins.view.js+79 added-35 removed
40 unmodified lines
41 set('partials', 'spec/fixtures/partials')42 end43 44 describe 'given a valid view name'45 it 'should render a partial'46 get('/', function(){47 this.render('list.html.haml', { locals: { items: ['foo', 'bar'] }})48 })49 get('/').body.should.include '<ul>'50 get('/').body.should.include '<li>foo'51 get('/').body.should.include '<li>bar'52 end53 54 it 'should render collections'55 get('/', function(){56 return this.partial('item.html.haml', {57 collection: ['foo', 'bar']45 describe 'with EJS'46 it 'should render a partial'47 get('/', function(){48 this.render('list.html.ejs', { locals: { items: ['foo', 'bar'] }})49 })59 })60 get('/').body.should.include '<li>foo'61 get('/').body.should.include '<li>bar'62 end63 64 it 'should render collections with a given object name'65 get('/', function(){66 return this.partial('video.html.haml', {67 collection: ['im a movie', 'im another movie'],68 as: 'vid'50 get('/').body.should.include '<ul>'51 get('/').body.should.include '<li>foo'52 get('/').body.should.include '<li>bar'53 end54 55 it 'should render collections'56 get('/', function(){57 return this.partial('item.html.ejs', {58 collection: ['foo', 'bar']59 })60 })61 get('/').body.should.include '<li>foo'62 get('/').body.should.include '<li>bar'63 end64 65 it 'should render collections with a given object name'66 get('/', function(){67 return this.partial('video.html.ejs', {68 collection: ['im a movie', 'im another movie'],69 as: 'vid'70 })70 })71 get('/').body.should.include '<li>im a movie'72 get('/').body.should.include '<li>im another movie'71 })72 get('/').body.should.include '<li>im a movie'73 get('/').body.should.include '<li>im another movie'74 end75 76 it 'should pass __isFirst__, __isLast__, and __index__ to partials as locals'77 get('/', function(){78 return this.partial('article.html.ejs', {79 collection: ['a', 'b', 'c']80 })81 })82 get('/').body.should.include '<li class="first">a'83 get('/').body.should.include '<li class="1">b'84 get('/').body.should.include '<li class="last">c'85 end86 end74 75 it 'should pass __isFirst__, __isLast__, and __index__ to partials as locals'76 get('/', function(){77 return this.partial('article.html.haml', {78 collection: ['a', 'b', 'c']87 describe 'with Haml'88 it 'should render a partial'89 get('/', function(){90 this.render('list.html.haml', { locals: { items: ['foo', 'bar'] }})91 })92 get('/').body.should.include '<ul>'93 get('/').body.should.include '<li>foo'94 get('/').body.should.include '<li>bar'95 end96 97 it 'should render collections'98 get('/', function(){99 return this.partial('item.html.haml', {100 collection: ['foo', 'bar']101 })102 })103 get('/').body.should.include '<li>foo'104 get('/').body.should.include '<li>bar'105 end106 107 it 'should render collections with a given object name'108 get('/', function(){109 return this.partial('video.html.haml', {110 collection: ['im a movie', 'im another movie'],111 as: 'vid'112 })113 })114 get('/').body.should.include '<li>im a movie'115 get('/').body.should.include '<li>im another movie'116 end117 118 it 'should pass __isFirst__, __isLast__, and __index__ to partials as locals'119 get('/', function(){120 return this.partial('article.html.haml', {121 collection: ['a', 'b', 'c']122 })80 })81 get('/').body.should.include '<li class="first">a'82 get('/').body.should.include '<li class="1">b'83 get('/').body.should.include '<li class="last">c'123 })124 get('/').body.should.include '<li class="first">a'125 get('/').body.should.include '<li class="1">b'126 get('/').body.should.include '<li class="last">c'127 end128 end129 end130 end131
141 unmodified lines