Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1578 from rmutter/ticket_20821

Fixed #20821 -- Added tooltips to Admin SelectBox widget
  • Loading branch information...
commit d5df914fe14fd96cec1cd3465852b8da72e7c5f6 2 parents ce5e093 + c438cc2
@jphalip jphalip authored
View
5 django/contrib/admin/static/admin/js/SelectBox.js
@@ -16,7 +16,10 @@ var SelectBox = {
for (var i = 0, j = SelectBox.cache[id].length; i < j; i++) {
var node = SelectBox.cache[id][i];
if (node.displayed) {
- box.options[box.options.length] = new Option(node.text, node.value, false, false);
+ var new_option = new Option(node.text, node.value, false, false);
+ // Shows a tooltip when hovering over the option
+ new_option.setAttribute("title", node.text);
+ box.options[box.options.length] = new_option;
}
}
},
View
11 tests/admin_widgets/tests.py
@@ -699,7 +699,12 @@ def execute_basic_operations(self, mode, field_name):
self.assertActiveButtons(mode, field_name, False, False, True, False)
# Choose some options ------------------------------------------------
- self.get_select_option(from_box, str(self.lisa.id)).click()
+ from_lisa_select_option = self.get_select_option(from_box, str(self.lisa.id))
+
+ # Check the title attribute is there for tool tips: ticket #20821
+ self.assertEqual(from_lisa_select_option.get_attribute('title'), from_lisa_select_option.get_attribute('text'))
+
+ from_lisa_select_option.click()
self.get_select_option(from_box, str(self.jason.id)).click()
self.get_select_option(from_box, str(self.bob.id)).click()
self.get_select_option(from_box, str(self.john.id)).click()
@@ -714,6 +719,10 @@ def execute_basic_operations(self, mode, field_name):
[str(self.lisa.id), str(self.bob.id),
str(self.jason.id), str(self.john.id)])
+ # Check the tooltip is still there after moving: ticket #20821
+ to_lisa_select_option = self.get_select_option(to_box, str(self.lisa.id))
+ self.assertEqual(to_lisa_select_option.get_attribute('title'), to_lisa_select_option.get_attribute('text'))
+
# Remove some options -------------------------------------------------
self.get_select_option(to_box, str(self.lisa.id)).click()
self.get_select_option(to_box, str(self.bob.id)).click()
Please sign in to comment.
Something went wrong with that request. Please try again.