Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Commit

Permalink
Remove theme variants classes.
Browse files Browse the repository at this point in the history
Since both layouts do not extend the generated classes and already have an api that covers all the variants,
it makes no sense to have variants classes here.
  • Loading branch information
Kirill Bulatov committed Jul 18, 2018
1 parent bdcec25 commit d622718
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 108 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ protected void initView() {
private void createDefaultHorizontalLayout() {
// begin-source-example
// source-example-heading: Default horizontal layout
// by default, spacing is on
HorizontalLayout layout = new HorizontalLayout();
layout.getStyle().set("border", "1px solid #9E9E9E");

Expand All @@ -68,6 +67,12 @@ private void createDefaultHorizontalLayout() {
Component component3 = createComponent(3, "#37474F");

layout.add(component1, component2, component3);

// shorthand methods for changing the component theme variants
layout.setPadding(false);
layout.setMargin(true);
// just a demonstration of the API, by default the spacing is on
layout.setSpacing(true);
// end-source-example

layout.setId("default-layout");
Expand Down Expand Up @@ -289,6 +294,12 @@ private void createDefaultVerticalLayout() {
Component component3 = createComponent(3, "#37474F");

layout.add(component1, component2, component3);

// shorthand methods for changing the component theme variants
layout.setPadding(false);
layout.setMargin(true);
// just a demonstration of the API, by default the spacing is on
layout.setSpacing(true);
// end-source-example

layout.setId("default-layout");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ public void defaultLayout() {
Assert.assertTrue(
"By default layout should contain spacing theme in 'theme' attribute",
hLayout.getAttribute("theme").contains("spacing"));
Assert.assertTrue(
"By default layout should contain margin theme in 'theme' attribute",
hLayout.getAttribute("theme").contains("margin"));

checkThemeChanges(hLayout, "spacing", false);
checkThemeChanges(hLayout, "margin", false);

Assert.assertNull(
"After turning off spacing, layout should not contain 'theme' attribute",
"After turning off spacing and margin, layout should not contain 'theme' attribute",
hLayout.getAttribute("theme"));

checkThemeChanges(hLayout, "padding", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ public void defaultLayout() {
assertBasicFlexPropertiesAreSet(vLayout);

Assert.assertTrue(
"By default layout should contain both spacing and padding themes in 'theme' attribute",
vLayout.getAttribute("theme").contains("spacing")
&& vLayout.getAttribute("theme").contains("padding"));
"By default layout should contain spacing theme in 'theme' attribute",
vLayout.getAttribute("theme").contains("spacing"));
Assert.assertTrue(
"By default layout should contain margin theme in 'theme' attribute",
vLayout.getAttribute("theme").contains("margin"));

checkThemeChanges(vLayout, "padding", false);
checkThemeChanges(vLayout, "spacing", false);
checkThemeChanges(vLayout, "margin", false);

Assert.assertNull(
"After turning off spacing and padding, layout should not contain 'theme' attribute",
Expand Down

0 comments on commit d622718

Please sign in to comment.