more work on testing procedure
This commit is contained in:
parent
85b129d06b
commit
f25155ea8d
@ -25,18 +25,24 @@ BuildTest =
|
|||||||
if postData.no is post.ID
|
if postData.no is post.ID
|
||||||
root = Build.postFromObject postData, post.board.ID
|
root = Build.postFromObject postData, post.board.ID
|
||||||
post2 = new Post root, post.thread, post.board
|
post2 = new Post root, post.thread, post.board
|
||||||
if post.normalizedHTML is post2.normalizedHTML
|
if post.normalizedOriginal.isEqualNode post2.normalizedOriginal
|
||||||
c.log "#{post.fullID} correct"
|
c.log "#{post.fullID} correct"
|
||||||
else
|
else
|
||||||
c.log "#{post.fullID} differs"
|
c.log "#{post.fullID} differs"
|
||||||
i = 0
|
html = post.normalizedOriginal.innerHTML
|
||||||
while i < post.normalizedHTML.length and i < post2.normalizedHTML.length
|
html2 = post2.normalizedOriginal.innerHTML
|
||||||
break unless post.normalizedHTML[i] is post2.normalizedHTML[i]
|
if html is html2
|
||||||
i++
|
c.log post.normalizedOriginal.outerHTML
|
||||||
c.log post.normalizedHTML[i..i+80]
|
c.log post2.normalizedOriginal.outerHTML
|
||||||
c.log post2.normalizedHTML[i..i+80]
|
else
|
||||||
c.log post.normalizedHTML
|
i = 0
|
||||||
c.log post2.normalizedHTML
|
while i < html.length and i < html2.length
|
||||||
|
break unless html[i] is html2[i]
|
||||||
|
i++
|
||||||
|
c.log html[i..i+80]
|
||||||
|
c.log html2[i..i+80]
|
||||||
|
c.log html
|
||||||
|
c.log html2
|
||||||
post2.isFetchedQuote = true
|
post2.isFetchedQuote = true
|
||||||
Main.callbackNodes Post, [post2]
|
Main.callbackNodes Post, [post2]
|
||||||
|
|
||||||
@ -45,5 +51,5 @@ BuildTest =
|
|||||||
|
|
||||||
testAll: ->
|
testAll: ->
|
||||||
g.posts.forEach (post) ->
|
g.posts.forEach (post) ->
|
||||||
unless post.isClone or post.isFetchedQuote
|
unless post.isClone or post.isFetchedQuote or $ '.abbr', post.nodes.comment
|
||||||
BuildTest.runTest post
|
BuildTest.runTest post
|
||||||
|
|||||||
@ -10,9 +10,11 @@ class Post
|
|||||||
href = el.href
|
href = el.href
|
||||||
href = href.replace /(^\w+:\/\/boards.4chan.org\/[^\/]+\/thread\/\d+)\/.*/, '$1'
|
href = href.replace /(^\w+:\/\/boards.4chan.org\/[^\/]+\/thread\/\d+)\/.*/, '$1'
|
||||||
el.setAttribute 'href', href
|
el.setAttribute 'href', href
|
||||||
|
for el in $$ 'a[rel=canonical]', root2
|
||||||
|
el.removeAttribute 'rel'
|
||||||
for el in $$ 'img[src]', root2
|
for el in $$ 'img[src]', root2
|
||||||
el.src = el.src.replace /^(\w+:\/\/)[0-2](\.t\.4cdn\.org\/)/, '$10$2'
|
el.src = el.src.replace /^(\w+:\/\/)[0-2](\.t\.4cdn\.org\/)/, '$10$2'
|
||||||
@normalizedHTML = root2.outerHTML
|
@normalizedOriginal = root2
|
||||||
|
|
||||||
@ID = +root.id[2..]
|
@ID = +root.id[2..]
|
||||||
@fullID = "#{@board}.#{@ID}"
|
@fullID = "#{@board}.#{@ID}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user