sponsor Vim development Vim logo Vim Book Ad

Jasmine snippets (for snipMate) : A set of snippets for the Jasmine JavaScript BDD Framework

 script karma  Rating 21/8, Downloaded by 801  Comments, bugs, improvements  Vim wiki

created by
Brian Egan
 
script type
utility
 
description
Jasmine (http://pivotal.github.com/jasmine/) is a behavior-driven-development framework for JavaScript with some very nice features. This set of snipMate snippets aims to make developing tests with Jasmine quicker and easier.

For example, rather than typing out the full:

"description('Description Here', function() {});"

You can type "des<TAB>". This will create the full description block, with convenient tab stops. Tre magnifique!

List of Included Snippets (this is actually just the file):

# After Each
snippet aft
afterEach(function() {
${1}
}

# Any
snippet any
jasmine.any(${1})

# Before Each
snippet bef
beforeEach(function() {
${1}
});

# Describe
snippet des
describe("${1:description}", function() {
${2}
});${3}

# Expect not to be defined
snippet notd
expect(${1:target}).not.toBeDefined();${2}

# Expect not to be falsy
snippet notf
expect(${1:target}).not.toBeFalsy();${2}

# Expect not to be null
snippet notn
expect(${1:target}).not.toBeNull();${2}

# Expect to be truthy
snippet nott
expect(${1:target}).not.toBeTruthy();${2}

# Expect not to contain
snippet notc
expect(${1:target}).not.toContain(${2:value});${3}

# Expect not to equal
snippet note
expect(${1:target}).not.toEqual(${2:value});${3}

# Expect not to match
snippet notm
expect(${1:target}).not.toBeDefined();${2}

# Expect not
snippet notx
expect(${1:target}).not;${2}

# Expect to be defined
snippet ed
expect(${1:target}).toBeDefined();${2}

# Expect to be falsy
snippet ef
expect(${1:target}).toBeFalsy();${2}

# Expect to be null
snippet en
expect(${1:target}).toBeNull();${2}

# Expect to be truthy
snippet et
expect(${1:target}).toBeTruthy();${2}

# Expect to contain
snippet ec
expect(${1:target}).toContain(${2:value});${3}

# Expect to equal
snippet ee
expect(${1:target}).toEqual(${2:value});${3}

# Expect to match
snippet em
expect(${1:target}).toMatch(${2:pattern});${3}

# Expect was called with
snippet escw
expect(${1:target}).wasCalledWith(${2:arguments});${3}

# Expect was called
snippet esc
expect(${1:target}).wasCalled();${2}

# Expect was not called with
snippet notscw
expect(${1:target}).wasNotCalledWith(${2:arguments});${3}

# Expect was not called
snippet notsc
expect(${1:target}).wasNotCalled();${3}

# Expect
snippet ex
expect(${1:target});${2}

# It
snippet it
it("${1:description}", function() {
${2}
});${3}

# Runs
snippet ru
runs(function() {
${1}
});${2}

# Spy on and call fake
snippet scf
spyOn(${1:object}, "${2:method}").andCallFake(${3:function});${4}

# Spy on and call through
snippet sct
spyOn(${1:object}, "${2:method}").andCallThrough();${3}

# Spy on and return
snippet sr
spyOn(${1:object}, "${2:method}").andReturn(${3:arguments});${4}

# Spy on and throw
snippet st
spyOn(${1:object}, "${2:method}").andThrow(${3:exception});${4}

# Spy on
snippet s
spyOn(${1:object}, "${2:method}");${3}

# Waits (wa)
snippet wa
waits(${1});${2}
 
install details
First, install snipMate if you do not have it installed (http://www.vim.org/scripts/script.php?script_id=2540)

Then, copy javascript-jasmine.snippets to $VIMRUNTIME/snippets/.

Launch a new instance of Vim, and play with the magic!
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
javascript-jasmine.snippets 0.1.0 2010-09-22 7.0 Brian Egan Initial upload
ip used for rating: 18.217.144.32

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github