summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2014-11-18 11:57:51 -0800
committerPhilip Chimento <philip@endlessm.com>2014-11-18 11:57:51 -0800
commit5b050ccdc07e642580778443d91cd8d880dace9e (patch)
treeef4c7ce30e6be664fa2907f47deca49572c58882
parent72fbe1cd2fe49a7982e248181a20f1651131e089 (diff)
TopbarNavButton works with no_show_all
Previously, if you created an Endless.TopbarNavButton with no_show_all set to TRUE, and subsequently called show() on it, it would not become visible, because the child widgets were still not shown. By showing them at construct time, we solve this problem because they immediately become visible when the TopbarNavButton widget itself is shown. [endlessm/eos-sdk#2495]
-rw-r--r--overrides/endless_private/topbar_nav_button.js2
-rw-r--r--test/endless/Makefile.am.inc1
-rw-r--r--test/endless/testTopbarNavButton.js17
3 files changed, 20 insertions, 0 deletions
diff --git a/overrides/endless_private/topbar_nav_button.js b/overrides/endless_private/topbar_nav_button.js
index ef79094..9f8f952 100644
--- a/overrides/endless_private/topbar_nav_button.js
+++ b/overrides/endless_private/topbar_nav_button.js
@@ -64,6 +64,8 @@ const TopbarNavButton = new Lang.Class({
this.add(this._back_button);
this.add(this._forward_button);
+ this._back_button.show();
+ this._forward_button.show();
},
get back_button() {
diff --git a/test/endless/Makefile.am.inc b/test/endless/Makefile.am.inc
index 536a878..5e83d2f 100644
--- a/test/endless/Makefile.am.inc
+++ b/test/endless/Makefile.am.inc
@@ -16,4 +16,5 @@ test_endless_run_tests_LDADD = $(TEST_LIBS)
javascript_tests += \
test/endless/testCustomContainer.js \
+ test/endless/testTopbarNavButton.js \
$(NULL)
diff --git a/test/endless/testTopbarNavButton.js b/test/endless/testTopbarNavButton.js
new file mode 100644
index 0000000..50849d2
--- /dev/null
+++ b/test/endless/testTopbarNavButton.js
@@ -0,0 +1,17 @@
+const Endless = imports.gi.Endless;
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
+
+Gtk.init(null);
+
+describe('TopbarNavButton', function () {
+ it('works correctly with no_show_all', function () {
+ let button = new Endless.TopbarNavButton({
+ no_show_all: true,
+ });
+ button.show();
+ expect(button.visible).toBe(true);
+ expect(button.back_button.visible).toBe(true);
+ expect(button.forward_button.visible).toBe(true);
+ });
+});