capybara-angular-material 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a9e05377a686c08839fe8136a9f1748e980656d
4
- data.tar.gz: ea08376bc26dc88b60336c721ddc19eb06f9b4f9
3
+ metadata.gz: 6e86f0a5b733d0917ee4c245c4f512b642c98cd1
4
+ data.tar.gz: 39848f88505aed8438c09b76fbaf2df8c2a7884b
5
5
  SHA512:
6
- metadata.gz: 37a7a2e08325a47f808bcd5e74217ad8111c6730605b61c7d8f01d598af1e39af0c42142ca7f2e1b4cbdeb7d7b7f2c8946e813183483b9b0f6889218625555b0
7
- data.tar.gz: f4c4d9e5e65d7017160d011209de1f0b1c28e99a7b2fecc3294ee2665eaf38d65ee8d87103849abd25f43e71416446d588b37bbe0ae80305f38202ca94a42be5
6
+ metadata.gz: a954b976e9358d677dd943a3de13aa1cc55e57b82318a91ac781fa9815f53f4471d5f61d5c1591a8708dc6e80a4de446fbc6600cd9c1dbb68a3e439746bd4794
7
+ data.tar.gz: ecd92bbdf5c9da95356af4bca653c6601cf4fab26f8c3822ff07a680c65ce76c33c64c12fbe81cca6d24cae5e02f29ab0adad013c9e128ddf4d8fec5e0f9ff08
data/.gitignore CHANGED
@@ -1,7 +1,5 @@
1
1
  .DS_Store
2
2
  *.gem
3
- .rvmrc
4
- .ruby-version
5
3
  .ruby-gemset
6
4
  .bundle
7
5
  node_modules
@@ -0,0 +1 @@
1
+ 2.2.1
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ![Build Status](https://circleci.com/gh/rimian/capybara-angular-material.png?style=shield&circle-token=f2873eb8a682807f1581927204052742bf8ecd94 "Build Status")
4
4
  [![Gem Version](https://badge.fury.io/rb/capybara-angular-material.svg)](http://badge.fury.io/rb/capybara-angular-material)
5
5
 
6
- This includes a number of selectors for testing [Angular Material](https://material.angularjs.org) components.
6
+ A DSL for interacting and/or checking against [Angular Material](https://material.angularjs.org) components.
7
7
 
8
8
  This is tested using the capybara/poltergeist driver.
9
9
 
@@ -29,37 +29,23 @@ RSpec.configure do |config|
29
29
  end
30
30
  ```
31
31
 
32
- ### Checkboxes
32
+ ## The DSL
33
33
 
34
- This tag: `<md-checkbox>Some text</md-checkbox>`
34
+ ### Querying forms
35
35
 
36
36
  ```
37
37
  have_md_checkbox('Some text')
38
- ```
39
-
40
- Checked is ignored unless set in options:
41
-
42
- ```
43
38
  have_md_checkbox('Other thing', :checked => true)
44
- ```
45
-
46
- Checked boolean is matched against the `aria-checked` attribute.
47
-
48
- ### Buttons
49
-
50
- ```
51
39
  have_md_button('Some text')
52
- ```
53
-
54
- ### Radio Button
55
-
56
- ```
57
40
  have_md_radio_button('Banana', :checked => true)
58
41
  have_md_radio_button('Banana')
42
+ have_md_radio_button('Some place holder text')
59
43
  ```
60
44
 
61
- ### Select
45
+ ### Interacting with forms
62
46
 
63
47
  ```
64
- have_md_radio_button('Some place holder text')
48
+ md_check('A checkbox')
49
+ md_uncheck('A checkbox')
50
+ md_select('An option', :from => 'Select Menu')
65
51
  ```
@@ -10,6 +10,27 @@ module Capybara
10
10
  def md_uncheck(locator)
11
11
  find(:xpath, "//md-checkbox/*/span[normalize-space(text())='#{locator}']").click
12
12
  end
13
+
14
+ def md_select(value, options={})
15
+ # trigger('click') prevents an overlapping element error.
16
+ find(:xpath, "//md-select/md-select-value/span[not(@class)][text()='#{options[:from]}']").trigger('click')
17
+ expect(page).to have_no_selector(:xpath, select_md_text_xpath)
18
+ find(
19
+ :xpath,
20
+ %{
21
+ //div[ contains(@class, 'md-active')\
22
+ and contains(@class, 'md-clickable')\
23
+ and contains(@class, 'md-select-menu-container')]\
24
+ /*/md-content/md-option[@value='#{value}']}
25
+ ).trigger('click')
26
+ expect(page).to have_selector(:xpath, select_md_text_xpath)
27
+ end
28
+
29
+ private
30
+
31
+ def select_md_text_xpath
32
+ "//md-select-value/span/*[contains(@class, 'md-text')]"
33
+ end
13
34
  end
14
35
  end
15
36
  end
@@ -22,7 +22,7 @@ module Capybara
22
22
  HaveSelector.new(:xpath, "//md-radio-button#{aria_checked(options)}/*/span[normalize-space(text())='#{locator}']")
23
23
  end
24
24
 
25
- def have_md_select(locator)
25
+ def have_md_select(locator, options={})
26
26
  HaveSelector.new(:xpath, "//md-select/md-select-value/span[not(@class)][text()='#{locator}']")
27
27
  end
28
28
 
@@ -8,7 +8,17 @@ feature 'Angular Material Demos - select' do
8
8
  expect(page).to have_md_select('State')
9
9
  end
10
10
 
11
+ it 'has a select with place holder' do
12
+ expect(page).to have_md_select('State')
13
+ end
14
+
11
15
  it 'has no select' do
12
16
  expect(page).not_to have_md_select('Oh, no!')
13
17
  end
18
+
19
+ describe 'Selecting' do
20
+ it 'selects an option' do
21
+ md_select('AZ', :from => 'State')
22
+ end
23
+ end
14
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-angular-material
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rimian Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-07 00:00:00.000000000 Z
11
+ date: 2016-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -90,7 +90,8 @@ dependencies:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: 1.4.6
93
- description: Provides selectors to test Angular Material Directives with Capybara
93
+ description: A set of Capybara selectors query and interact with Angular Material
94
+ Directives
94
95
  email:
95
96
  - hello@rimian.com.au
96
97
  executables: []
@@ -99,6 +100,7 @@ extra_rdoc_files: []
99
100
  files:
100
101
  - ".gitignore"
101
102
  - ".rspec"
103
+ - ".ruby-version"
102
104
  - CONTRIBUTING
103
105
  - Gemfile
104
106
  - LICENSE