Permalink
Browse files

changed test-noscript.js to use assertParseInfo().

  • Loading branch information...
toolness committed Apr 27, 2012
1 parent 86dda42 commit e42fadfb948c9d1e7ed3b295d85f6c21372c35db
Showing with 11 additions and 24 deletions.
  1. +11 −24 test/test-noscript.js
View
@@ -12,43 +12,30 @@ test("SCRIPT_ELEMENT_NOT_ALLOWED error is reported", function() {
var ndb = new Slowparse.NoscriptDOMBuilder(document);
var html = '<script>alert("yo");</script>';
var result = Slowparse.HTML(ndb, html);
- deepEqual(result.error, {
- type: "SCRIPT_ELEMENT_NOT_ALLOWED",
- start: 0,
- end: 7
+ equal(result.error.type, "SCRIPT_ELEMENT_NOT_ALLOWED");
+ assertParseInfo(html, result, "result", {
+ 'error': '<script'
});
});
test("EVENT_HANDLER_ATTR_NOT_ALLOWED error is reported", function() {
var ndb = new Slowparse.NoscriptDOMBuilder(document);
var html = '<p onclick="alert(\'yo\');">hi</p>';
var result = Slowparse.HTML(ndb, html);
- deepEqual(result.error, {
- type: "EVENT_HANDLER_ATTR_NOT_ALLOWED",
- name: {
- start: 3,
- end: 10
- },
- value: {
- start: 11,
- end: 25
- }
+ equal(result.error.type, "EVENT_HANDLER_ATTR_NOT_ALLOWED");
+ assertParseInfo(html, result.error, "error", {
+ 'name': 'onclick',
+ 'value': '"alert(\'yo\');"'
});
});
test("JAVASCRIPT_URL_NOT_ALLOWED error is reported", function() {
var ndb = new Slowparse.NoscriptDOMBuilder(document);
var html = '<a href="javascript:alert(\'yo\');">hi</a>';
var result = Slowparse.HTML(ndb, html);
- deepEqual(result.error, {
- type: "JAVASCRIPT_URL_NOT_ALLOWED",
- name: {
- start: 3,
- end: 7
- },
- value: {
- start: 8,
- end: 33
- }
+ equal(result.error.type, "JAVASCRIPT_URL_NOT_ALLOWED");
+ assertParseInfo(html, result.error, "error", {
+ 'name': 'href',
+ 'value': '"javascript:alert(\'yo\');"'
});
});

0 comments on commit e42fadf

Please sign in to comment.