[Checkins] SVN: gocept.selenium/trunk/ made selectWindow accept window id None or no id at all

Thomas Lotze tl at gocept.com
Wed Dec 7 15:35:18 UTC 2011


Log message for revision 123620:
  made selectWindow accept window id None or no id at all

Changed:
  U   gocept.selenium/trunk/CHANGES.txt
  U   gocept.selenium/trunk/src/gocept/selenium/selenese.py
  U   gocept.selenium/trunk/src/gocept/selenium/tests/test_selenese.py

-=-
Modified: gocept.selenium/trunk/CHANGES.txt
===================================================================
--- gocept.selenium/trunk/CHANGES.txt	2011-12-07 15:28:44 UTC (rev 123619)
+++ gocept.selenium/trunk/CHANGES.txt	2011-12-07 15:35:18 UTC (rev 123620)
@@ -9,7 +9,10 @@
 
 - API expansion: added ``openWindow``.
 
+- backwards-compatible API change: ``selectWindow`` now selects the main
+  window also when passed the window id ``None`` or no argument at all.
 
+
 0.12 (2011-11-29)
 -----------------
 

Modified: gocept.selenium/trunk/src/gocept/selenium/selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/selenese.py	2011-12-07 15:28:44 UTC (rev 123619)
+++ gocept.selenium/trunk/src/gocept/selenium/selenese.py	2011-12-07 15:35:18 UTC (rev 123620)
@@ -337,9 +337,8 @@
     def selectFrame(self):
         pass
 
-    @passthrough
-    def selectWindow(self, window_id):
-        pass
+    def selectWindow(self, window_id=None):
+        return self.selenium.select_window(window_id or 'null')
 
     @passthrough
     def submit(self, locator):

Modified: gocept.selenium/trunk/src/gocept/selenium/tests/test_selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/tests/test_selenese.py	2011-12-07 15:28:44 UTC (rev 123619)
+++ gocept.selenium/trunk/src/gocept/selenium/tests/test_selenese.py	2011-12-07 15:35:18 UTC (rev 123620)
@@ -302,5 +302,17 @@
         self.selenium.selectWindow(u'null')
         self.selenium.assertEval('window.name', u'selenium_main_app_window')
 
+    def test_selecting_none_selects_main_window(self):
+        self.selenium.openWindow('', 'foo')
+        self.selenium.selectWindow('foo')
+        self.selenium.selectWindow(None)
+        self.selenium.assertEval('window.name', u'selenium_main_app_window')
+
+    def test_select_without_arg_selects_main_window(self):
+        self.selenium.openWindow('', 'foo')
+        self.selenium.selectWindow('foo')
+        self.selenium.selectWindow()
+        self.selenium.assertEval('window.name', u'selenium_main_app_window')
+
     def test_new_window_cannot_have_name_null(self):
         self.assertRaises(ValueError, self.selenium.openWindow, '', 'null')



More information about the checkins mailing list