summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/NEWS.txt4
-rw-r--r--Lib/idlelib/configdialog.py1
-rw-r--r--Lib/idlelib/idle_test/test_configdialog.py21
3 files changed, 18 insertions, 8 deletions
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 729d405..b721733 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,7 +3,9 @@ Released on 2019-12-16?
======================================
-bpo-39050: Make Settings dialog Help button work again.
+bpo-39388: Settings dialog Cancel button cancels pending changes.
+
+bpo-39050: Settings dialog Help button again displays help text.
bpo-32989: Add tests for editor newline_and_indent_event method.
Remove unneeded arguments and dead code from pyparse
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index 0e007b5..2f95c9c 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -191,6 +191,7 @@ class ConfigDialog(Toplevel):
Methods:
destroy: inherited
"""
+ changes.clear()
self.destroy()
def destroy(self):
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
index 7c575d0..817a3521 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -47,17 +47,24 @@ def tearDownModule():
root.destroy()
root = dialog = None
-class ConfigDialogTest(unittest.TestCase):
- def test_help(self):
+class DialogTest(unittest.TestCase):
+
+ @mock.patch(__name__+'.dialog.destroy', new_callable=Func)
+ def test_cancel(self, destroy):
+ changes['main']['something'] = 1
+ dialog.cancel()
+ self.assertEqual(changes['main'], {})
+ self.assertEqual(destroy.called, 1)
+
+ @mock.patch('idlelib.configdialog.view_text', new_callable=Func)
+ def test_help(self, view):
dialog.note.select(dialog.keyspage)
- saved = configdialog.view_text
- view = configdialog.view_text = Func()
dialog.help()
s = view.kwds['contents']
- self.assertTrue(s.startswith('When you click'))
- self.assertTrue(s.endswith('a different name.\n'))
- configdialog.view_text = saved
+ self.assertTrue(s.startswith('When you click') and
+ s.endswith('a different name.\n'))
+
class FontPageTest(unittest.TestCase):
"""Test that font widgets enable users to make font changes.