mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
💄
This commit is contained in:
parent
eeb20673b3
commit
a622da2904
@ -39,15 +39,13 @@ fdescribe "Template", ->
|
||||
it "extends the view with viewProperties, calling the 'constructor' property if present", ->
|
||||
expect(view.constructor).toBeDefined()
|
||||
expect(view.foo).toBe("bar")
|
||||
expect(view.initializeCalledWith).toEqual(title: "Zebra")
|
||||
expect(view.initializeCalledWith).toEqual title: "Zebra"
|
||||
|
||||
it "wires references for elements with 'outlet' attributes", ->
|
||||
expect(view.li1).toMatchSelector("li.foo:contains(one)")
|
||||
expect(view.li2).toMatchSelector("li.bar:contains(two)")
|
||||
expect(view.li1).toMatchSelector "li.foo:contains(one)"
|
||||
expect(view.li2).toMatchSelector "li.bar:contains(two)"
|
||||
|
||||
it "binds events for elements with event name attributes", ->
|
||||
spyOn(view, 'li1Clicked')
|
||||
spyOn(view, 'li2Keypressed')
|
||||
spyOn(view, 'li1Clicked').andCallFake (event, elt) ->
|
||||
expect(event.type).toBe 'click'
|
||||
expect(elt).toMatchSelector 'li.foo:contains(one)'
|
||||
|
@ -8,34 +8,34 @@ fdescribe "Builder", ->
|
||||
describe ".tag(name, args...)", ->
|
||||
it "can generate simple tags", ->
|
||||
builder.tag 'div'
|
||||
expect(builder.toHtml()).toBe("<div></div>")
|
||||
expect(builder.toHtml()).toBe "<div></div>"
|
||||
|
||||
builder.reset()
|
||||
builder.tag 'ol'
|
||||
expect(builder.toHtml()).toBe("<ol></ol>")
|
||||
expect(builder.toHtml()).toBe "<ol></ol>"
|
||||
|
||||
it "can generate tags with content", ->
|
||||
builder.tag 'ol', ->
|
||||
builder.tag 'li'
|
||||
builder.tag 'li'
|
||||
|
||||
expect(builder.toHtml()).toBe("<ol><li></li><li></li></ol>")
|
||||
expect(builder.toHtml()).toBe "<ol><li></li><li></li></ol>"
|
||||
|
||||
it "can generate tags with text", ->
|
||||
builder.tag 'div', "hello"
|
||||
expect(builder.toHtml()).toBe("<div>hello</div>")
|
||||
expect(builder.toHtml()).toBe "<div>hello</div>"
|
||||
|
||||
builder.reset()
|
||||
builder.tag 'div', 22
|
||||
expect(builder.toHtml()).toBe("<div>22</div>")
|
||||
expect(builder.toHtml()).toBe "<div>22</div>"
|
||||
|
||||
it "can generate tags with attributes", ->
|
||||
builder.tag 'div', id: 'foo', class: 'bar'
|
||||
fragment = builder.toFragment()
|
||||
expect(fragment.attr('id')).toBe('foo')
|
||||
expect(fragment.attr('class')).toBe('bar')
|
||||
expect(fragment.attr('id')).toBe 'foo'
|
||||
expect(fragment.attr('class')).toBe 'bar'
|
||||
|
||||
it "can generate self-closing tags", ->
|
||||
builder.tag 'br', id: 'foo'
|
||||
expect(builder.toHtml()).toBe('<br id="foo">')
|
||||
expect(builder.toHtml()).toBe '<br id="foo">'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user