From 02c4c685ae915326a63754c4dc3f88b7f5fc7149 Mon Sep 17 00:00:00 2001
From: vitalets <noginsk@rambler.ru>
Date: Tue, 27 Nov 2012 13:47:29 +0400
Subject: [PATCH] fix tests for abs position and date clear

---
 test/unit/common.js | 12 +++++++++++-
 test/unit/date.js   |  2 +-
 test/unit/dateui.js |  4 ++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/unit/common.js b/test/unit/common.js
index c6fd49e..468c48e 100644
--- a/test/unit/common.js
+++ b/test/unit/common.js
@@ -122,7 +122,17 @@
         ok(!p.is(':visible'), 'popover closed');
      });        
       
-      
+     test("should not wrap buttons when parent has position:absolute", function () {
+        var  d = $('<div style="position: absolute; top: 200px">').appendTo(fx),
+             e = $('<a href="#" data-pk="1" data-url="post.php" data-name="text1">abc</a>').appendTo(d).editable();
+            
+        e.click();
+        var p = tip(e);
+        ok(p.find('button').offset().top < p.find('.editable-input').offset().top + p.find('.editable-input').height(), 'buttons top ok');
+        ok(p.find('button').offset().left > p.find('.editable-input').offset().left + p.find('.editable-input').width(), 'buttons left ok');
+       
+        d.remove();
+     });       
       
       //unfortunatly, testing this feature does not always work in browsers. Tested manually.
       /*
diff --git a/test/unit/date.js b/test/unit/date.js
index 83f6707..16ca25a 100644
--- a/test/unit/date.js
+++ b/test/unit/date.js
@@ -153,7 +153,7 @@ $(function () {
         equal(frmt(e.data('editable').value, f), d, 'day set correct');
         equal(p.find('td.day.active').text(), 15, 'day shown correct');
 
-        var clear = p.find('.editable-clear');
+        var clear = p.find('.editable-clear a');
         equal(clear.text(), 'abc', 'clear link shown');
 
         //click clear
diff --git a/test/unit/dateui.js b/test/unit/dateui.js
index f6a1d20..5af7255 100644
--- a/test/unit/dateui.js
+++ b/test/unit/dateui.js
@@ -105,7 +105,7 @@ $(function () {
         equal(frmt(e.data('editable').value, f), d, 'day set correct');
         equal(p.find('a.ui-state-active').text(), 15, 'day shown correct');
 
-        var clear = p.find('.editable-clear');
+        var clear = p.find('.editable-clear a');
         equal(clear.text(), 'abc', 'clear link shown');
 
         //click clear
@@ -118,7 +118,7 @@ $(function () {
            equal(e.text(), e.data('editable').options.emptytext, 'empty text shown');
            e.remove();    
            start();  
-        }, timeout); 
+        }, 500); 
         
      });