diff --git a/src/UniversalDashboard.Materialize/Scripts/layout.ps1 b/src/UniversalDashboard.Materialize/Scripts/layout.ps1 index fb12324b..e49c7ba9 100644 --- a/src/UniversalDashboard.Materialize/Scripts/layout.ps1 +++ b/src/UniversalDashboard.Materialize/Scripts/layout.ps1 @@ -7,13 +7,15 @@ function New-UDLayout { ) $Components = $Content.Invoke() - $columnSize = 12 / $Columns + $LargeColumnSize = 12 / $Columns + $MediumColumnSize = (12 / $Columns) * 2 + $SmallColumnSize = 12 $Offset = 0 $ComponentCount = ($Components | Measure-Object).Count while ($Offset -lt $ComponentCount) { $ColumnObjects = $Components | Select-Object -Skip $Offset -First $Columns | ForEach-Object { - New-UDColumn -Size $ColumnSize -Content { + New-UDColumn -SmallSize $SmallColumnSize -MediumSize $MediumColumnSize -LargeSize $LargeColumnSize -Content { $_ } } diff --git a/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 b/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 index d7fb07f7..312cc6d0 100644 --- a/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 +++ b/src/UniversalDashboard.Materialize/Tests/layout.tests.ps1 @@ -14,4 +14,17 @@ Describe "New-UDLayout" { (Find-SeElement -ClassName 'col' -Driver $Driver).Count | Should be 4 } } + + Context "Should set mobile friendly column sizes" { + $Layout = New-UDLayout -Columns 3 -Content { + New-UDCard -Title "Test" -Content {} + New-UDCard -Title "Test" -Content {} + New-UDCard -Title "Test" -Content {} + 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 + } } \ No newline at end of file