[3.6] bpo-30870: IDLE: Add configdialog fontlist selection unittest (GH-2666) (#2701)

Initial patch by Louie Lu.
(cherry picked from commit 9b622fb)
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index a2cfaab..0d68b80 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -47,7 +47,8 @@
         self.parent = parent
         if _htest:
             parent.instance_dict = {}
-        self.withdraw()
+        if not _utest:
+            self.withdraw()
 
         self.configure(borderwidth=5)
         self.title(title or 'IDLE Preferences')
@@ -76,7 +77,6 @@
         self.create_widgets()
         self.resizable(height=FALSE, width=FALSE)
         self.transient(parent)
-        self.grab_set()
         self.protocol("WM_DELETE_WINDOW", self.cancel)
         self.fontlist.focus_set()
         # XXX Decide whether to keep or delete these key bindings.
@@ -88,6 +88,7 @@
         self.attach_var_callbacks()  # Avoid callbacks during load_configs.
 
         if not _utest:
+            self.grab_set()
             self.wm_deiconify()
             self.wait_window()