Sha256: 480b05af8f3176eb3ce31bf8ba6c34f7431881d176ae7c855982ce5ec2c30490

Contents?: true

Size: 872 Bytes

Versions: 19

Compression:

Stored size: 872 Bytes

Contents

# Quick Backbone/CoffeeScript tests to make sure that inheritance
# works correctly.

{ok, equal, deepEqual}      = require 'assert'
{Model, Collection, Events} = require '../backbone'


# Patch `ok` to store a count of passed tests...
count = 0
oldOk = ok
ok = ->
  oldOk arguments...
  count++


class Document extends Model

  fullName: ->
    @get('name') + ' ' + @get('surname')

tempest = new Document
  id      : '1-the-tempest',
  title   : "The Tempest",
  name    : "William"
  surname : "Shakespeare"
  length  : 123

ok tempest.fullName() is "William Shakespeare"
ok tempest.get('length') is 123


class ProperDocument extends Document

  fullName: ->
    "Mr. " + super

properTempest = new ProperDocument tempest.attributes

ok properTempest.fullName() is "Mr. William Shakespeare"
ok properTempest.get('length') is 123


console.log "passed #{count} tests"

Version data entries

19 entries across 18 versions & 2 rubygems

Version Path
jdl-0.0.5 test/model.coffee
jdl-0.0.4 test/model.coffee
jdl-0.0.3 test/model.coffee
jdl-0.0.2 test/model.coffee
jdl-0.0.1 test/model.coffee
bpm-1.0.0 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.rc.4 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.rc.3 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.rc.2 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.rc.1 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.13 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.12 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.11 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.10 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.9 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.8 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.6 spec/fixtures/packages/backbone/test/model.coffee
bpm-1.0.0.beta.5 backbone/test/model.coffee
bpm-1.0.0.beta.5 spec/fixtures/packages/backbone/test/model.coffee