Layering Functionality ontop of the javascript plugin
Hi All,
I'm trying to develop an IDEA plugin for the crosscheck browserless javascript testing framework http://dev.thefrontside.net/crosscheck
I'd like to just add a simple few features to the existing javascript plugin since crosscheck scripts are 100% plain vanilla javascript, and so work quite well with the javascript plugin. The only thing that I want to add is an action to run the script as a crosscheck test, and optionally to run a single crosscheck test (if the run action is invoked within a test method).
Here is an example of a crosscheck scrip taken from the crosscheck selftest suitte. If I have this open in an editor window, I'd like hitting run to run all the test cases. And if you're in a specific method, have run do just that test.
crosscheck.suite('Javascript Host Object Protocol', {
def: function(body) {
return crosscheck.metadef(body)
},
test_a_readwrite_attribute_can_be_changed_but_is_not_deleted: function() {
var Instance = this.def(function($) {
this.attrReadWrite('one', 'two')
})
var i = new Instance()
i.one = 'one'
assertEquals('one', i.one)
i.one = 1
assertEquals(1, i.one)
delete i.one
assertEquals(1, i.one)
},
test_define_a_readonly_attribute_via_a_getter: function() {
var Circle = this.def(function($) {
this.constructor(function(radius) {
$(this).radius = radius
})
this.attrReadOnly('radius')
this.attrReadOnly('diameter', function() {
return $(this).radius * 2
})
})
var c = new Circle(5)
assertEquals(5, c.radius)
assertEquals(10, c.diameter)
}
})
All the examples I've seen involve writing a custom language from scratch, but I don't think that's what I want in this case. I want to add these to bits of functionality and leave the rest of the javascript heavy lifting to the standard plugin. Is there a standard way of layering functionality onto existing language support?
thanks,
Charles
Please sign in to leave a comment.
Any suggestions as to the right set of docs would be greatly appreciated.
cheers,
Charles