mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Template.subview expects a view instance instead of a template and params hash.
This commit is contained in:
parent
8455507566
commit
b25fc80c9a
@ -16,7 +16,7 @@ describe "Template", ->
|
||||
@div =>
|
||||
@h1 attrs.title
|
||||
@list()
|
||||
@subview 'subview', subviewTemplate, title: "Subview"
|
||||
@subview 'subview', subviewTemplate.build(title: "Subview")
|
||||
|
||||
list: ->
|
||||
@ol =>
|
||||
|
@ -53,7 +53,7 @@ describe "Builder", ->
|
||||
it "inserts a view built from the given template with the given params", ->
|
||||
builder.tag 'div', ->
|
||||
builder.tag 'h1', "Superview"
|
||||
builder.subview 'sub', template, title: "Subview"
|
||||
builder.subview 'sub', template.build(title: "Subview")
|
||||
|
||||
fragment = builder.toFragment()
|
||||
expect(fragment.find("h1:contains(Superview)")).toExist()
|
||||
|
@ -41,11 +41,10 @@ class Builder
|
||||
@text(options.text) if options.text
|
||||
@document.push(new CloseTag(name))
|
||||
|
||||
subview: (outletName, template, params) ->
|
||||
subview: (outletName, subview) ->
|
||||
subviewId = _.uniqueId('subview')
|
||||
@tag 'div', id: subviewId
|
||||
@postProcessingFns.push (view) ->
|
||||
subview = template.build(params)
|
||||
subview.attr('outlet', outletName)
|
||||
view.find("div##{subviewId}").replaceWith(subview)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user