diff --git a/src/UniversalDashboard.Materialize/Scripts/layout.ps1 b/src/UniversalDashboard.Materialize/Scripts/layout.ps1 index fe508074..f2a819c2 100644 --- a/src/UniversalDashboard.Materialize/Scripts/layout.ps1 +++ b/src/UniversalDashboard.Materialize/Scripts/layout.ps1 @@ -1,15 +1,27 @@ function New-UDLayout { param( [Parameter(Mandatory = $true)] + [ValidateRange(1, 12)] [int]$Columns, [Parameter(Mandatory = $true)] [ScriptBlock]$Content ) $Components = $Content.Invoke() - $LargeColumnSize = 12 / $Columns - $MediumColumnSize = 12 / $Columns - $SmallColumnSize = 12 + + if ($Columns -eq 1) + { + $LargeColumnSize = 12 + $MediumColumnSize = 12 + $SmallColumnSize = 12 + } + else + { + $LargeColumnSize = 12 / $Columns + $MediumColumnSize = 12 / ($Columns / 2) + $SmallColumnSize = 12 + } + $Offset = 0 $ComponentCount = ($Components | Measure-Object).Count diff --git a/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 b/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 index 312cc6d0..275f1cd8 100644 --- a/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 +++ b/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 @@ -23,8 +23,26 @@ Describe "New-UDLayout" { New-UDCard -Title "Test" -Content {} } - $Layout[0].Content[0].Attributes["className"].Contains("s12") | should be $true - $Layout[0].Content[0].Attributes["className"].Contains("m8") | should be $true - $Layout[0].Content[0].Attributes["className"].Contains("l4") | should be $true + it "should contain all sizes" { + $Layout[0].Content[0].Attributes["className"].Contains("s12") | should be $true + $Layout[0].Content[0].Attributes["className"].Contains("m8") | should be $true + $Layout[0].Content[0].Attributes["className"].Contains("l4") | should be $true + } + + } + + Context "should not show error when column set to 1" { + $Layout = New-UDLayout -Columns 1 -Content { + New-UDCard -Title "Test" -Content {} + New-UDCard -Title "Test" -Content {} + New-UDCard -Title "Test" -Content {} + New-UDCard -Title "Test" -Content {} + } + + it "should contain all sizes" { + $Layout[0].Content[0].Attributes["className"].Contains("s12") | should be $true + $Layout[0].Content[0].Attributes["className"].Contains("m12") | should be $true + $Layout[0].Content[0].Attributes["className"].Contains("l12") | should be $true + } } } \ No newline at end of file diff --git a/src/UniversalDashboard.UITest/Integration/AutoReload.Tests.ps1 b/src/UniversalDashboard.UITest/Integration/AutoReload.Tests.ps1 index 9d645f8d..1134a791 100644 --- a/src/UniversalDashboard.UITest/Integration/AutoReload.Tests.ps1 +++ b/src/UniversalDashboard.UITest/Integration/AutoReload.Tests.ps1 @@ -71,7 +71,7 @@ Describe "Auto reload" { It "auto reloads" { - Start-Sleep 1 + Start-Sleep 3 Invoke-RestMethod http://localhost:10001/api/user | should be "2" @@ -84,7 +84,7 @@ Describe "Auto reload" { $Server = Start-UDRestApi -Port 10001 -Endpoint $Endpoint -AutoReload }.ToString().Replace('$ModulePath', "'$ModulePath'") | Out-File $tempFile -Force - Start-Sleep 1 + Start-Sleep 3 Invoke-RestMethod http://localhost:10001/api/user | should be "1" } diff --git a/src/UniversalDashboard.UITest/Integration/Grid.Tests.ps1 b/src/UniversalDashboard.UITest/Integration/Grid.Tests.ps1 index a40adb7e..7c9d1713 100644 --- a/src/UniversalDashboard.UITest/Integration/Grid.Tests.ps1 +++ b/src/UniversalDashboard.UITest/Integration/Grid.Tests.ps1 @@ -64,7 +64,7 @@ Describe "Grid" { $data = @( [PSCustomObject]@{"day" = 1; jpg = $Variable; mp4= (New-UDLink -Text "This is text" -Url "http://www.google.com")} [PSCustomObject]@{"day" = 2; jpg = "20"; mp4= (Get-Date -Day 2 -Month 12 -Year 2007)} - [PSCustomObject]@{"day" = 3; jpg = $true; mp4= (New-UDButton -Text "Hey" -OnClick{ Set-UDElement -Id "Hey" -Content {"Hey"}})} + [PSCustomObject]@{"day" = 3; jpg = $true; mp4= (New-UDButton -Id button -Text "Hey" -OnClick{ Set-UDElement -Id "Hey" -Content {"Hey"}})} [PSCustomObject]@{"day" = 3; jpg = $true; mp4= (New-UDIcon -Icon check -Color Green)} ) @@ -78,7 +78,7 @@ Describe "Grid" { Set-TestDashboard -Dashboard $dashboard It "should click button" { - $Button = Find-SeElement -LinkText "HEY" -Driver $Driver + $Button = Find-SeElement -Id "button" -Driver $Driver Invoke-SeClick -Element $Button Start-Sleep -Seconds 5 @@ -233,19 +233,19 @@ Describe "Grid" { $Element = Find-SeElement -ClassName "griddle-row" -Driver $Driver $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Element[0] - $Element.Length | Should be 3 - $Element[0].Text | should be "3" - $Element[1].Text | should be "30" - $Element[2].Text | should be "10" + $Element.Length | Should be 2 + $Element[0].Text | should be "1" + $Element[1].Text | should be "10" + $Element[2].Text | should be "30" } It "should sort data" { $Row = Find-SeElement -ClassName "griddle-row" -Driver $Driver $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Row[0] - $Element[0].Text | should be "3" + $Element[0].Text | should be "1" $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Row[1] - $Element[0].Text | should be "3" + $Element[0].Text | should be "1" $Element = Find-SeElement -ClassName "griddle-table-heading-cell" -Driver $Driver $header = $element[0] @@ -253,9 +253,9 @@ Describe "Grid" { $Row = Find-SeElement -ClassName "griddle-row" -Driver $Driver $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Row[0] - $Element[0].Text | should be "1" + $Element[0].Text | should be "3" $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Row[1] - $Element[0].Text | should be "1" + $Element[0].Text | should be "3" $Element = Find-SeElement -ClassName "griddle-table-heading-cell" -Driver $Driver $header = $element[0] @@ -263,9 +263,9 @@ Describe "Grid" { $Row = Find-SeElement -ClassName "griddle-row" -Driver $Driver $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Row[0] - $Element[0].Text | should be "3" + $Element[0].Text | should be "1" $Element = Find-SeElement -ClassName "griddle-cell" -Driver $Row[1] - $Element[0].Text | should be "3" + $Element[0].Text | should be "1" } It "should filter data" { diff --git a/src/UniversalDashboard.UITest/Manifest.Tests.ps1 b/src/UniversalDashboard.UITest/Manifest.Tests.ps1 index ea73c494..ab1c08e2 100644 --- a/src/UniversalDashboard.UITest/Manifest.Tests.ps1 +++ b/src/UniversalDashboard.UITest/Manifest.Tests.ps1 @@ -11,7 +11,7 @@ Get-UDDashboard | Stop-UDDashboard Describe "Manifest" { It "should have correct version" { - (Get-Module 'UniversalDashboard.Community').Version | Should be "2.4.0" + (Get-Module 'UniversalDashboard.Community').Version | Should be "2.4.1" } It "should have correct exported commands" { diff --git a/src/UniversalDashboard/New-UDModuleManifest.ps1 b/src/UniversalDashboard/New-UDModuleManifest.ps1 index ec39b487..63129e45 100644 --- a/src/UniversalDashboard/New-UDModuleManifest.ps1 +++ b/src/UniversalDashboard/New-UDModuleManifest.ps1 @@ -5,7 +5,7 @@ param( Remove-Item (Join-Path $outputDirectory 'UniversalDashboard.Community.psd1') -ErrorAction SilentlyContinue -Force -$version = "2.4.0" +$version = "2.4.1" #$prerelease = "-beta2" $ReleaseNotes = " @@ -17,7 +17,7 @@ $manifestParameters = @{ Path = "$outputDirectory\UniversalDashboard.Community.psd1" Author = "Adam Driscoll" CompanyName = "Ironman Software, LLC" - Copyright = "2018 Ironman Software, LLC" + Copyright = "2019 Ironman Software, LLC" RootModule = "UniversalDashboard.psm1" Description = "Cross-platform module for developing websites and REST APIs." ModuleVersion = $version