Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add caja_builder for optional cajoled tests.

  • Loading branch information...
commit 99f74b526a492b8183d17b7ac29d78f4a6a491b7 1 parent 52a781a
@tobie tobie authored
View
3  .gitmodules
@@ -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
30 Rakefile
@@ -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
53 test/unit/caja_whitelists/html_attrib.json
@@ -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
@@ -0,0 +1 @@
+Subproject commit aeda517c2e82db92bc88d56ed68fa4ce05f487a9
Please sign in to comment.
Something went wrong with that request. Please try again.