From 613baa6a839be63d7fb990918ddfef0992afea12 Mon Sep 17 00:00:00 2001 From: Shane Tomlinson <stomlinson@mozilla.com> Date: Wed, 9 Nov 2011 16:43:02 +0000 Subject: [PATCH] Tooltips now show the contents close #547 --- resources/static/dialog/resources/tooltip.js | 3 +-- resources/static/test/qunit.html | 2 +- resources/static/test/qunit/resources/tooltip_unit_test.js | 6 +++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/resources/static/dialog/resources/tooltip.js b/resources/static/dialog/resources/tooltip.js index 01a3b34a2..602602b4a 100644 --- a/resources/static/dialog/resources/tooltip.js +++ b/resources/static/dialog/resources/tooltip.js @@ -45,7 +45,7 @@ BrowserID.Tooltip = (function() { function createTooltip(el) { var contents = el.html(); var template = $("#templateTooltip").html(); - _.templatesettings = { + _.templateSettings = { interpolate : /\{\{(.+?)\}\}/g }; var tooltip = $(_.template(template, { @@ -89,7 +89,6 @@ BrowserID.Tooltip = (function() { positionTooltip(tooltip, target); animateTooltip(tooltip, function() { - console.log("close tooltip"); if (tooltip) { tooltip.remove(); tooltip = null; diff --git a/resources/static/test/qunit.html b/resources/static/test/qunit.html index 66a3ce39f..3e2ae0292 100644 --- a/resources/static/test/qunit.html +++ b/resources/static/test/qunit.html @@ -70,7 +70,7 @@ </script> <script type="text/html" id="templateTooltip"> - <div class="tooltip"> + <div class="tooltip" id="createdTooltip"> {{ contents }} </div> </script> diff --git a/resources/static/test/qunit/resources/tooltip_unit_test.js b/resources/static/test/qunit/resources/tooltip_unit_test.js index 85dae3a28..ab1269319 100644 --- a/resources/static/test/qunit/resources/tooltip_unit_test.js +++ b/resources/static/test/qunit/resources/tooltip_unit_test.js @@ -52,7 +52,6 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/tooltip", func var startTime = new Date().getTime(); tooltip.showTooltip("#shortTooltip", function() { - console.log("calling tooltip back"); var endTime = new Date().getTime(); var diff = endTime - startTime; ok(2000 <= diff && diff <= 3000, diff + " - minimum of 2 seconds, max of 3 seconds"); @@ -60,6 +59,11 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/tooltip", func start(); }); + var el = $("#createdTooltip"); + equal(el.length, 1, "one tooltip created"); + var contents = el.html() || ""; + equal(contents.indexOf("contents") === -1, true, "contents have been replaced"); + stop(); }); -- GitLab