capybara-angular-material 0.0.10 → 0.0.11

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: b9ab3aa3628acdc910386639acea589c1bd5a04b
4
- data.tar.gz: 36f030f884e82f6176dc80262ec7e87b8b0ab281
3
+ metadata.gz: afd2c1ad54c4cf1184cff22b7aa01d5c631e44ec
4
+ data.tar.gz: 63c2d10434176e5a8051760dceaeeab514d8b454
5
5
  SHA512:
6
- metadata.gz: 5adbeb191be30ab9fc9972e932fa0c7e50bb8a5895b378985e13a62243e803c58a49398c8a67740858611c43a0c1025fc58b54ffce749fe4871befecc38ffaa7
7
- data.tar.gz: cfc30aa8a18053baa440ca681671fe53d7fab98449869d93c3bc0c4d2c561b13e7d3eda036f0fdf6f53fbbd8b9665235a4f6ffca0997d47dca5a112f26c4d511
6
+ metadata.gz: 1adf0e5dc7ff733f88b3c339841b34f1687d22144e997e1c83da61ef45eae4fc03f492284ca829ea715819add2410154632651f1249188a71f081b07dfef1987
7
+ data.tar.gz: 6b2abaa1c541f39217d53f0fb38e5dcbb436bef1a192bbcd414c57159b2d53607800507f531b1a7d9d658aa2477d5af26a9139aef294ac3c029af7e5dbb29a04
data/README.md CHANGED
@@ -7,6 +7,8 @@ This includes a number of selectors for testing [Angular Material](https://mater
7
7
 
8
8
  This is tested using the capybara/poltergeist driver.
9
9
 
10
+ If you want to test how this works locally, check out this repo, install then run ```rackup -p8000```. You'll see the paths in the app.js file. eg: ```localhost:8000/#/radio```. I'll get around to documenting more later.
11
+
10
12
  ## Installation
11
13
 
12
14
  Add this line to your application's Gemfile:
@@ -1,10 +1,12 @@
1
1
  require 'capybara/angular/material/rspec'
2
+ require 'capybara/angular/material/node/actions'
2
3
 
3
4
  module Capybara
4
5
  module Angular
5
6
  module Material
6
- include Capybara::Angular::Material::RSpecMatchers
7
7
  include Capybara::RSpecMatchers
8
+ include Capybara::Angular::Material::RSpecMatchers
9
+ include Capybara::Angular::Material::Node::Actions
8
10
  end
9
11
  end
10
12
  end
@@ -0,0 +1,17 @@
1
+ module Capybara
2
+ module Angular
3
+ module Material
4
+ module Node
5
+ module Actions
6
+ def md_check(locator)
7
+ find(:xpath, "//md-checkbox/*/span[normalize-space(text())='#{locator}']").click
8
+ end
9
+
10
+ def md_uncheck(locator)
11
+ find(:xpath, "//md-checkbox/*/span[normalize-space(text())='#{locator}']").click
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -7,7 +7,7 @@ module Capybara
7
7
  end
8
8
 
9
9
  def have_md_checkbox(locator, options={})
10
- HaveSelector.new(:xpath, "//md-checkbox#{aria_checked(options)}/*/span[normalize-space(text())='#{locator}']")
10
+ HaveSelector.new(:xpath, "//md-checkbox#{aria_checked(options)}#{ng_disabled(options)}/*/span[normalize-space(text())='#{locator}']")
11
11
  end
12
12
 
13
13
  def have_md_radio_button(locator, options={})
@@ -23,6 +23,10 @@ module Capybara
23
23
  def aria_checked(options)
24
24
  "[@aria-checked='#{options[:checked].to_s}']" if options.has_key?(:checked)
25
25
  end
26
+
27
+ def ng_disabled(options)
28
+ "[@ng-disabled='#{options[:disabled].to_s}']" if options.has_key?(:disabled)
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -8,7 +8,16 @@ feature 'Angular Material Demos - Checkbox' do
8
8
  expect(page.find('h1')).to have_content 'Capybara Angular Material'
9
9
  end
10
10
 
11
- it 'is disabled'
11
+ it 'is disabled' do
12
+ expect(page).to have_md_checkbox('Checkbox: Disabled', :disabled => true)
13
+ expect(page).not_to have_md_checkbox('Checkbox: Disabled', :disabled => false)
14
+ end
15
+
16
+ it 'is disabled and checked' do
17
+ expect(page).to have_md_checkbox('Checkbox: Disabled, Checked', :disabled => true, :checked => true)
18
+ expect(page).not_to have_md_checkbox('Checkbox: Disabled, Checked', :disabled => false, :checked => true)
19
+ end
20
+
12
21
  it 'is not disabled'
13
22
 
14
23
  it 'has no checkbox' do
@@ -42,4 +51,21 @@ feature 'Angular Material Demos - Checkbox' do
42
51
  it 'is checked' do
43
52
  expect(page).not_to have_md_checkbox(checked_locator, :checked => false)
44
53
  end
54
+
55
+ feature 'checking/unchecking a checkbox' do
56
+ scenario 'check unchecked checkbox' do
57
+ expect(page).to have_md_checkbox(unchecked_locator, :checked => false)
58
+ md_check(unchecked_locator)
59
+ expect(page).to have_md_checkbox(unchecked_locator, :checked => true)
60
+ end
61
+
62
+ scenario 'uncheck checked checkbox' do
63
+ expect(page).to have_md_checkbox('Checkbox 1: true', :checked => true)
64
+ md_uncheck('Checkbox 1: true')
65
+ expect(page).to have_md_checkbox('Checkbox 1: false', :checked => false)
66
+ end
67
+
68
+ scenario 'uncheck unchecked checkbox'
69
+ scenario 'uncheck checked checkbox'
70
+ end
45
71
  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.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rimian Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -90,7 +90,7 @@ dependencies:
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: 1.4.6
93
- description: Provides selectors to test Angular Material Directives
93
+ description: Provides selectors to test Angular Material Directives with Capybara
94
94
  email:
95
95
  - hello@rimian.com.au
96
96
  executables: []
@@ -112,6 +112,7 @@ files:
112
112
  - config.ru
113
113
  - index.html
114
114
  - lib/capybara/angular/material.rb
115
+ - lib/capybara/angular/material/node/actions.rb
115
116
  - lib/capybara/angular/material/rspec.rb
116
117
  - package.json
117
118
  - spec/features/demos/button_spec.rb