Skip to content
Myr

spec.plugins.js

This file

Path

spec/spec.plugins.js

39 lines · 864 bytes · JavaScript

Last changed by

Calling Plugin.init() when availablevisionmediabefore adoption78d538a

History of this file

Take it

Started Pluginvisionmediabefore adoption8158a3d

line 1why, one step back
1

CSSVariables -> CSSColors examplevisionmediabefore adoption5c7341c

line 2why, one step back
2CSSColors = Plugin.extend({

Calling Plugin.init() when availablevisionmediabefore adoption78d538a

lines 3–7why, one step back
3 extend: {
4 init: function() {5 this.initialized = true6 }7 },

Started Pluginvisionmediabefore adoption8158a3d

line 8why, one step back
8 on: {

e -> eventvisionmediabefore adoption60b4571

lines 9–11why, one step back
9 response: function(event) {
10 if (event.response.headers['content-type'] == mime('css'))11 event.response.body = event.response.body.replace('black', '#000')

Started Pluginvisionmediabefore adoption8158a3d

lines 12–19why, one step back
12 }
13 }14})1516describe 'Express'17 describe 'use()'18 before_each19 reset()

CSSVariables -> CSSColors examplevisionmediabefore adoption5c7341c

line 20why, one step back
20 use(CSSColors)

Calling Plugin.init() when availablevisionmediabefore adoption78d538a

lines 21–24why, one step back
21 end
22 23 it 'should call .init on plugins when available'24 CSSColors.initialized.should.be_true

Started Pluginvisionmediabefore adoption8158a3d

lines 25–27why, one step back
25 end
26 27 describe 'events'

Added Event data arg specvisionmediabefore adoption3d4d62a

line 28why, one step back
28 describe 'response'

Started Pluginvisionmediabefore adoption8158a3d

lines 29–30why, one step back
29 it 'should be triggered before headers and body are sent'
30 get('/style.css', function(){

Fixing more specsvisionmediabefore adoption3a90a78

line 31why, one step back
31 this.contentType('css')

Started Pluginvisionmediabefore adoption8158a3d

lines 32–39why, one step back
32 return 'body { color: black; }'
33 })34 get('/style.css').body.should.eql 'body { color: #000; }'35 end36 end37 end38 end39end