<commit_before>var tape = require("tape")
var post = require("../../src/scripts/views/post")

require("../../src/scripts/lib/classList")

tape("post", function(test){
  var element = document.createElement("div")
  element.innerHTML = [
    "<span data-rcp-tooltip='foo {{wpm}} bar' data-readingtime-wpm='40' class='putainde-Post-readingTime putainde-Post-readingTime--hidden rcp-Tooltip rcp-Tooltip--top rcp-Tooltip--nowrap'>",
    "  Temps de lecture : environ ",
    "  <span class='putainde-Post-readingTime-value'></span>",
    "  minutes",
    "</span>"
  ].join("")
  var postView = post.extend({
    element : element.querySelector(".putainde-Post-readingTime-value")
  })

  var postElement = document.createElement("div")
  postElement.className = "putainde-Post-md"
  document.body.appendChild(postElement)

  postElement.innerHTML = "<b>foo</b> bar baz <strong>foo bar baz</strong>"
  test.equal(postView.getDuration(), 0)
  postElement.innerHTML = Array(500).join("a ")
  test.equal(postView.getDuration(), 2)

  test.equal(postView.template().nodeType, 3)
  test.equal(postView.template().nodeValue, "2")
  test.equal(typeof postView.wordsPerMinute, "number", "has a default value")
  postView.parseWordsPerMinute()
  test.equal(postView.wordsPerMinute, 40, "gets value")
  element.children[0].removeAttribute("data-readingTime-wpm")
  delete postView.wordsPerMinute
  postView.parseWordsPerMinute()
  postView.show()
  test.equal(
    element.classList.contains("putainde-Post-readingTime--hidden"),
    false
  )
  test.equal(postView.wordsPerMinute, 250, "ignores if no data-attribute")
  postView.setTooltipWording()
  test.equal(element.children[0].getAttribute("data-rcp-tooltip"), "foo 250 bar")
  test.end()
})<commit_msg>Fix tests according to tooltip changes<commit_after>var tape = require("tape")
var post = require("../../src/scripts/views/post")

require("../../src/scripts/lib/classList")

tape("post", function(test){
  var element = document.createElement("div")
  element.innerHTML = [
    "<span data-cssr-tooltip='foo {{wpm}} bar' data-readingtime-wpm='40' class='putainde-Post-readingTime putainde-Post-readingTime--hidden cssr-Tooltip cssr-Tooltip--top cssr-Tooltip--nowrap'>",
    "  Temps de lecture : environ ",
    "  <span class='putainde-Post-readingTime-value'></span>",
    "  minutes",
    "</span>"
  ].join("")
  var postView = post.extend({
    element : element.querySelector(".putainde-Post-readingTime-value")
  })

  var postElement = document.createElement("div")
  postElement.className = "putainde-Post-md"
  document.body.appendChild(postElement)

  postElement.innerHTML = "<b>foo</b> bar baz <strong>foo bar baz</strong>"
  test.equal(postView.getDuration(), 0)
  postElement.innerHTML = Array(500).join("a ")
  test.equal(postView.getDuration(), 2)

  test.equal(postView.template().nodeType, 3)
  test.equal(postView.template().nodeValue, "2")
  test.equal(typeof postView.wordsPerMinute, "number", "has a default value")
  postView.parseWordsPerMinute()
  test.equal(postView.wordsPerMinute, 40, "gets value")
  element.children[0].removeAttribute("data-readingTime-wpm")
  delete postView.wordsPerMinute
  postView.parseWordsPerMinute()
  postView.show()
  test.equal(
    element.classList.contains("putainde-Post-readingTime--hidden"),
    false
  )
  test.equal(postView.wordsPerMinute, 250, "ignores if no data-attribute")
  postView.setTooltipWording()
  test.equal(element.children[0].getAttribute("data-cssr-tooltip"), "foo 250 bar")
  test.end()
})
{'fraction_non_alphanumeric': 0.1648664013644116, 'fraction_numerical': 0.010801591813530414, 'mean_word_length': 4.731270358306189, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1956537', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1158, 'n_words': 189}