Initial import
This commit is contained in:
commit
c55a704cbd
|
@ -0,0 +1,39 @@
|
||||||
|
h1. Vim Plugin for Jasmine javascript testing
|
||||||
|
|
||||||
|
This is my first attempt at a vim plugin bundle. I'm sure there are dragons in here. :-)
|
||||||
|
|
||||||
|
h2. Installation
|
||||||
|
|
||||||
|
I'm currently using Pathogen. That means you should be able to do:
|
||||||
|
|
||||||
|
bc. git clone git://github.com/claco/vim-jasmine.git bundle/jasmine
|
||||||
|
|
||||||
|
inside of your .vim directory. If you're using submodules to track your bundles:
|
||||||
|
|
||||||
|
bc. git submodule add git://github.com/pivotal/jasmine.git bundle/jasmine
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
h2. What it does
|
||||||
|
|
||||||
|
This plugin is pretty basic right now. It currently:
|
||||||
|
|
||||||
|
* Sets Spec.js and SpecHelper.js files to jasmine/javascript fileType
|
||||||
|
* Applies basic syntax highlighting for jasmine keywords in addition to normal javascript syntax
|
||||||
|
* Loads snippets for jasmine filetype for:
|
||||||
|
** desc: description block with before..it..expect
|
||||||
|
** before: beforeEach block
|
||||||
|
** after: afterEach block
|
||||||
|
** it: it...expect block
|
||||||
|
** helper: beforeEach block and matcher for SpecHelper.js
|
||||||
|
** matcher: matcher block for SpecHelper.js
|
||||||
|
|
||||||
|
h2. Known Issues
|
||||||
|
|
||||||
|
The jasmine snippets are loaded from a hardcoded path ~/.vim/bundle/jasmine/snippets. I need to figure out how to not do that.
|
||||||
|
|
||||||
|
h2. TODO
|
||||||
|
|
||||||
|
* Add commands/functions to run a spec, a spec file, and jasmine:ci
|
||||||
|
* Add Red/Green bard to spec runner output and error buffer support
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
au BufNewFile,BufRead,BufWritePost *[Ss]pec.js set filetype=javascript.jasmine syntax=jasmine
|
||||||
|
au BufNewFile,BufRead,BufWritePost *[Ss]pec[Hh]elper.js set filetype=javascript.jasmine syntax=jasmine
|
|
@ -0,0 +1,11 @@
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("g:loaded_jasmine_snippets")
|
||||||
|
call ExtractSnips("~/.vim/bundle/jasmine/snippets", "jasmine")
|
||||||
|
let g:loaded_jasmine_snippets = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
if exists("g:loaded_jasmine")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:loaded_jasmine=1
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
afterEach(function () {
|
||||||
|
${1}
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
beforeEach(function () {
|
||||||
|
${1}
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
describe('${1:when...}', function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
${2}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('${3:should...}', function () {
|
||||||
|
expect(${4:condition}).toEqual(${5});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
beforeEach(function() {
|
||||||
|
this.addMatchers({
|
||||||
|
|
||||||
|
to${1}: function() {
|
||||||
|
var summary = this.actual;
|
||||||
|
this.actual = summary.clone().wrap('<div>').parent().html();
|
||||||
|
|
||||||
|
${2}
|
||||||
|
|
||||||
|
return ${3:false};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
it('${1:should...}', function() {
|
||||||
|
expect(${2:condition}).toEqual(${3});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
to${1}: function() {
|
||||||
|
var summary = this.actual;
|
||||||
|
this.actual = summary.clone().wrap('<div>').parent().html();
|
||||||
|
|
||||||
|
${2}
|
||||||
|
|
||||||
|
return ${3:false};
|
||||||
|
},
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! syntax/javascript.vim
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
syn keyword specFunctions afterEach beforeEach describe it expect addMatchers spyOn not
|
||||||
|
syn match specMatcher "to[A-Za-z0-9_]*"
|
||||||
|
|
||||||
|
hi def link specFunctions Special
|
||||||
|
hi def link specMatcher Special
|
||||||
|
|
||||||
|
let b:current_syntax = "jasmine"
|
Loading…
Reference in New Issue