forked from teamcapybara/capybara
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move more of node functionality into subfolder
We have too many top level files, we have multiple classes in the same file. This allows us to solve both problems, while also providing a good place for the new Capybara::Node::Simple (formerly Capybara::StringNode)
- Loading branch information
Showing
15 changed files
with
393 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Capybara | ||
class Node | ||
module Node | ||
module Actions | ||
|
||
## | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module Capybara | ||
module Node | ||
|
||
## | ||
# | ||
# A {Capybara::Node::Base} represents either an element on a page through the subclass | ||
# {Capybara::Node::Element} or a document through {Capybara::Node::Document}. | ||
# | ||
# Both types of Node share the same methods, used for interacting with the | ||
# elements on the page. These methods are divided into three categories, | ||
# finders, actions and matchers. These are found in the modules | ||
# {Capybara::Node::Finders}, {Capybara::Node::Actions} and {Capybara::Node::Matchers} | ||
# respectively. | ||
# | ||
# A {Capybara::Session} exposes all methods from {Capybara::Node::Document} directly: | ||
# | ||
# session = Capybara::Session.new(:rack_test, my_app) | ||
# session.visit('/') | ||
# session.fill_in('Foo', :with => 'Bar') # from Capybara::Node::Actions | ||
# bar = session.find('#bar') # from Capybara::Node::Finders | ||
# bar.select('Baz', :from => 'Quox') # from Capybara::Node::Actions | ||
# session.has_css?('#foobar') # from Capybara::Node::Matchers | ||
# | ||
class Base | ||
attr_reader :session, :base | ||
|
||
include Capybara::Node::Finders | ||
include Capybara::Node::Actions | ||
include Capybara::Node::Matchers | ||
|
||
def initialize(session, base) | ||
@session = session | ||
@base = base | ||
end | ||
|
||
protected | ||
|
||
def wait? | ||
driver.wait? | ||
end | ||
|
||
def driver | ||
session.driver | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Capybara | ||
module Node | ||
|
||
## | ||
# | ||
# A {Capybara::Document} represents an HTML document. Any operation | ||
# performed on it will be performed on the entire document. | ||
# | ||
# @see Capybara::Node | ||
# | ||
class Document < Base | ||
def inspect | ||
%(#<Capybara::Document>) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.