Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
Merge pull request #1102 from ironmansoftware/1093
Browse files Browse the repository at this point in the history
Fixes #1093, #1080
  • Loading branch information
adamdriscoll authored Sep 12, 2019
2 parents 0540be3 + a2f6196 commit 85f9b1a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class UdInputField extends React.Component {
value={field.value}
onBlur={e => this.onValidateField(field, e)}
onKeyDown={this.onKeyDown.bind(this)}
placeholder={field.placeholder ? field.placeholder[0] : field.name}
label={field.placeholder ? field.placeholder[0] : field.name}
/>
}

Expand Down
66 changes: 26 additions & 40 deletions src/UniversalDashboard.Materialize/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/UniversalDashboard.Materialize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"react-debounce-input": "3.2.0",
"react-grid-layout": "^0.16.6",
"react-interval": "^2.0.1",
"react-materialize": "^3.3.0",
"react-materialize": "^3.4.1",
"react-treebeard": "^2.1.0",
"styled-components": "^4.2.0",
"terminal-in-react": "^4.3.1"
Expand Down
33 changes: 29 additions & 4 deletions src/UniversalDashboard.UITest/Integration/Input.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ $Driver = Start-SeFirefox

Describe "Input" {

Context "textbox" {
$Dashboard = New-UDDashboard -Title "Test" -Content {
New-UDInput -Title "Simple Form" -Id "Form" -Content {
New-UDInputField -Type 'textbox' -Name 'DepartmentNumber' -Placeholder 'Department Number ("2600922")'
} -Endpoint {
param($DepartmentNumber)

$Cache:Data = $Test
}
}

$Server.DashboardService.SetDashboard($Dashboard)
Enter-SeUrl -Driver $Driver -Url "http://localhost:$BrowserPort"

It "should have helper text" {
$Element = Find-SeElement -TagName 'label' -Driver $Driver
$Element.Text | Should be 'Department Number ("2600922")'
}
}

Context "grid in content" {
$Dashboard = New-UDDashboard -Title "Test" -Content {
New-UDInput -Title "Simple Form" -Id "Form" -Endpoint {
Expand Down Expand Up @@ -139,7 +159,8 @@ Describe "Input" {
$Element = Find-SeElement -Id 'EmailAddress' -Driver $Driver
Send-SeKeys -Element $Element -Keys 'a'
$Element = Find-SeElement -Id 'SomeOtherField' -Driver $Driver
Invoke-SeClick -Element $Element
Invoke-SeClick -Element $Element -JavaScriptClick -Driver $Driver
Send-SeKeys -Element $Element -Keys 'a'

(Find-SeElement -ClassName 'fa-times-circle' -Driver $Driver) | Get-SeElementAttribute -Attribute 'data-tooltip' | should be 'The email address you entered is invalid.'
}
Expand All @@ -149,9 +170,12 @@ Describe "Input" {
Enter-SeUrl -Driver $Driver -Url "http://localhost:$BrowserPort"

$Element = Find-SeElement -Id 'SomeOtherField' -Driver $Driver
Invoke-SeClick -Element $Element
Invoke-SeClick -Element $Element -JavaScriptClick -Driver $Driver
Send-SeKeys -Element $Element -Keys ''

$Element = Find-SeElement -Id 'EmailAddress' -Driver $Driver
Invoke-SeClick -Element $Element
Invoke-SeClick -Element $Element -JavaScriptClick -Driver $Driver
Send-SeKeys -Element $Element -Keys 'a'

(Find-SeElement -ClassName 'fa-times-circle' -Driver $Driver) | Get-SeElementAttribute -Attribute 'data-tooltip' | should be 'SomeOtherField is required.'
}
Expand Down Expand Up @@ -415,7 +439,8 @@ Describe "Input" {
}

It "should have friendly label for textbox" {
Find-SeElement -Id "Textbox" -Driver $Driver | Get-SeElementAttribute -Attribute "placeholder" | Should be "My Textbox"
$Element = Find-SeElement -TagName "label" -Driver $Driver | Where-Object { $_.Text -eq 'My Textbox' }
$Element | Should not be $null
}

It "should have friendly label for checkbox" {
Expand Down

0 comments on commit 85f9b1a

Please sign in to comment.