Permalink
Browse files

Removed within.

Closes #205.
  • Loading branch information...
1 parent ddc8939 commit 974e4ab9248b898132ef275d46b2f31f27178c80 @andrewsmedina andrewsmedina committed Jan 17, 2013
Showing with 1 addition and 60 deletions.
  1. +0 −4 splinter/driver/__init__.py
  2. +0 −29 splinter/within.py
  3. +1 −2 tests/base.py
  4. +0 −25 tests/within.py
@@ -8,7 +8,6 @@
This module contains the basic API for splinter drivers and elemnts.
"""
-from splinter.within import Within
from splinter.meta import InheritedDocs
from splinter.request_handler.request_handler import RequestHandler
@@ -317,9 +316,6 @@ def click_link_by_partial_text(self, partial_text):
"""
return self.find_link_by_partial_text(partial_text).first.click()
- def within(self, context):
- return Within(self.find_by_css(context))
-
def quit(self):
"""
Quits the browser, closing its windows (if it has one).
View
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2012 splinter authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-from element_list import ElementList
-
-
-class Within(object):
-
- def __init__(self, context_elements):
- self.context_elements = context_elements
-
- def find_by_css(self, finder):
- """Performs a find in the element context using the provided css selector"""
- final_elements = ElementList([])
- for context_element in self.context_elements:
- for element in context_element.find_by_css(finder):
- final_elements.append(element)
- return final_elements
-
- def find_by_xpath(self, finder):
- """Performs a find in the element context using the provided xpath selector"""
- final_elements = ElementList([])
- for context_element in self.context_elements:
- for element in context_element.find_by_xpath(finder):
- final_elements.append(element)
- return final_elements
-
View
@@ -13,7 +13,6 @@
from fake_webapp import EXAMPLE_APP
from find_elements import FindElementsTest
from form_elements import FormElementsTest
-from within import WithinTest
from iframes import IFrameElementsTest
from element import ElementTest
from is_element_present import IsElementPresentTest
@@ -24,7 +23,7 @@
from popups import PopupWindowsTest
-class BaseBrowserTests(ElementTest, FindElementsTest, FormElementsTest, ClickElementsTest, CookiesTest, SlowlyTypeTest, WithinTest):
+class BaseBrowserTests(ElementTest, FindElementsTest, FormElementsTest, ClickElementsTest, CookiesTest, SlowlyTypeTest):
def setUp(self):
self.fail("You should set up your browser in the setUp() method")
View
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2012 splinter authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-
-class WithinTest(object):
-
- def test_within_works_right(self):
- "should perform the find only inside the context"
- self.assertFalse(self.browser.find_by_css('h1').is_empty()) #make sure there's a h1
- self.assertTrue(self.browser.within('h1').find_by_css('body').is_empty())
-
- def test_find_by_css(self):
- "should find by css using context"
- elements = self.browser.within('body').find_by_css('h1')
- self.assertFalse(elements.is_empty())
-
- def test_find_by_xpath(self):
- "should find by xpath using context"
- xpath_elements = self.browser.within('body').find_by_xpath('//h1')
- css_elements = self.browser.within('body').find_by_css('h1')
- self.assertTrue(css_elements[0].value == xpath_elements[0].value)
-

0 comments on commit 974e4ab

Please sign in to comment.