Skip to content

stoltene2/jasminejs-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status MELPA

jasminejs-mode

jasminejs-mode helps you manipulate and edit Jasmine test files.

Changelog

  • 2015-05-26 -- Breaking Change Use fdescribe and fit instead of ddescribe and iit.

Installation

This mode is a minor mode. Usually you want to use it along side another mode like js2-mode or js3-mode. To use it along side js2-mode, simply add a hook.

(add-hook 'js2-mode-hook (lambda () (jasminejs-mode)))

You can now have this mode wherever you use js2-mode.

Keybinding

All keybindings in jasminejs-mode start with C-c C-j and then a two-letter mnemonic shortcut. You can customize jasminejs-prefix-key to change the prefix key.

  • it -- It Toggle between it and fit
  • ip -- It Pending between it and xit
  • dt -- Describe Toggle between describe and fdescribe
  • dp -- Describe Pending between describe and xdescribe

If you would prefer not to customize jasminejs-prefix-key you can add a new prefix key yourself. Personally, I prefer C-c j.

(add-hook 'jasminejs-mode-hook (lambda ()
  (local-set-key (kbd "C-c j") 'jasminejs-prefix-map)))

Snippets

Writing tests is nice when its easy. Make it easier by typing less.

Below are some snippets that can be loaded.

To load snippets you should load them after yasnippet is loaded and in the after hook.

For example,

(add-hook 'jasminejs-mode-hook (lambda () (jasminejs-add-snippets-to-yas-snippet-dirs)))

The function jasminejs-add-snippets-to-yas-snippet-dirs will declare jasminejs-mode as a mode that can load snippets and loads the default set of snippets for you.

key description
afte afterEach(...)
befe beforeEach(...)
desc describe(...)
ex expect(...)
expb expect(...).toBe(...)
expc expect(...).toHaveBeenCalled()
expcw expect(...).toHaveBeenCalledWith(...)
expe expect(...).toEqual(...)
expf expect(...).toBeFalsy()
expt expect(...).toBeTruthy()
it it(...)

Development

Intstall the dependencies with cask

cask install

Run the tests with:

$ cask exec ecukes

Special Thanks

I'd like to thank Magnars for creating such great modes for Emacs. The basis of this mode was inspired by his busterjs-mode.x

About

Minor mode for Jasmine tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published