Add caja_builder for optional cajoled tests.

This commit is contained in:
Tobie Langel 2008-12-12 13:55:28 +01:00
parent 52a781ae2a
commit 99f74b526a
4 changed files with 87 additions and 0 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "vendor/unittest_js"]
path = vendor/unittest_js
url = git://github.com/tobie/unittest_js.git
[submodule "vendor/caja_builder"]
path = vendor/caja_builder
url = git://github.com/tobie/unittest_js_caja_builder.git

View File

@ -116,3 +116,33 @@ end
task :clean_tmp do
puts '"rake clean_tmp" is deprecated. Please use "rake test:clean" instead.'
end
namespace :caja do
task :test => ['test:build', 'test:run']
namespace :test do
task :run => ['rake:test:run']
task :build => [:require, 'rake:test:clean', :dist] do
builder = UnittestJS::CajaBuilder::SuiteBuilder.new({
:input_dir => PROTOTYPE_TEST_UNIT_DIR,
:assets_dir => PROTOTYPE_DIST_DIR,
:whitelist_dir => File.join(PROTOTYPE_TEST_DIR, 'unit', 'caja_whitelists'),
:html_attrib_schema => 'html_attrib.json'
})
selected_tests = (ENV['TESTS'] || '').split(',')
builder.collect(*selected_tests)
builder.render
end
end
task :require => ['rake:test:require'] do
lib = 'vendor/caja_builder/lib/caja_builder'
unless File.exists?(lib)
puts "\nYou'll need UnittestJS to run the tests. Just run:\n\n"
puts " $ git submodule init"
puts " $ git submodule update"
puts "\nand you should be all set.\n\n"
end
require lib
end
end

View File

@ -0,0 +1,53 @@
{
"description": "Extends the default HTML attribute whiteList for Prototype testing purposes.",
"inherits": [
{
"src": "resource:///html4-attributes.json"
}
],
"allowed": [
"FORM:ACCEPT-CHARSET",
"DIV:FOO",
"DIV:BAR",
"A:ACCESSKEY"
],
"types": [
{
"key": "A:ACCESSKEY",
"description": "Allow the A:ACCESSKEY accessibility key character",
"pattern": ".?",
"optional": true
},
{
"key": "INPUT:TYPE",
"description": "Overwrite INPUT:TYPE rule to allow for DATE value.",
"pattern": "TEXT|PASSWORD|CHECKBOX|RADIO|SUBMIT|RESET|FILE|HIDDEN|IMAGE|BUTTON|DATE",
"optional": true
},
{
"key": "A:TABINDEX",
"description": "Overwrite A:TABINDEX to allow for an empty value",
"pattern": ".*",
"optional": true
},
{
"key": "DIV:FOO",
"description": "Custom BAR attribute.",
"pattern": ".*",
"optional": true
},
{
"key": "DIV:BAR",
"description": "Custom FOO attribute",
"pattern": ".*",
"optional": true
}
]
}

1
vendor/caja_builder vendored Submodule

@ -0,0 +1 @@
Subproject commit aeda517c2e82db92bc88d56ed68fa4ce05f487a9