Bladeren bron

Fix opacity value for disabled label and non-collapsible column (#15489)

Change-Id: I0d669f1c85feebcaa01c58fb81b5e20802440ef2
tags/7.7.0.alpha3
Denis Anisimov 9 jaren geleden
bovenliggende
commit
c6f185a1c4

+ 4
- 0
themes/src/main/themes/VAADIN/themes/valo/components/_label.scss Bestand weergeven

@@ -109,6 +109,10 @@ $v-letter-spacing--h4: 0 !default;

.#{$primary-stylename} {
@include user-select(text);

&.v-disabled {
@include opacity($v-disabled-opacity);
}
}

.#{$primary-stylename}-undef-w {

+ 4
- 0
themes/src/main/themes/VAADIN/themes/valo/components/_table.scss Bestand weergeven

@@ -456,6 +456,10 @@ $v-table-background-color: null !default;
div {
display: inline;
}

&.v-disabled {
@include opacity($v-disabled-opacity);
}
}
.v-off:before {
visibility: hidden;

+ 80
- 0
uitest/src/main/java/com/vaadin/tests/themes/valo/CollapsibleTableColumn.java Bestand weergeven

@@ -0,0 +1,80 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.themes.valo;

import com.vaadin.annotations.Theme;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Table;

/**
* Test UI for non-collapsible column distinction in the table.
*
* @author Vaadin Ltd
*/
@Theme("valo")
public class CollapsibleTableColumn extends AbstractTestUI {

@Override
protected void setup(VaadinRequest request) {
Table table = new Table();
BeanItemContainer<Bean> container = new BeanItemContainer<Bean>(
Bean.class);
Bean bean = new Bean();
bean.setName("name");
bean.setId(1);
container.addBean(bean);
table.setContainerDataSource(container);
table.setColumnCollapsingAllowed(true);
table.setColumnCollapsible("name", false);
addComponent(table);
}

@Override
protected Integer getTicketNumber() {
return 15489;
}

@Override
protected String getTestDescription() {
return "Non-collapsible column should be visibly distinct (has an opacity) from "
+ "collapsible column in table column config menu.";
}

public static class Bean {

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

private String name;

private int id;
}
}

+ 54
- 0
uitest/src/main/java/com/vaadin/tests/themes/valo/DisabledLabel.java Bestand weergeven

@@ -0,0 +1,54 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.themes.valo;

import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Label;

/**
* Test UI for disbaled label.
*
* @author Vaadin Ltd
*/
@Theme("valo")
public class DisabledLabel extends AbstractTestUI {

@Override
protected void setup(VaadinRequest request) {
Label enabled = new Label("enabled");
enabled.addStyleName("my-enabled");
addComponent(enabled);

Label disabled = new Label("disabled");
disabled.setEnabled(false);
disabled.addStyleName("my-disabled");

addComponent(disabled);
}

@Override
protected Integer getTicketNumber() {
return 15489;
}

@Override
protected String getTestDescription() {
return "Disabled label should be visibly disabled (has an opacity).";
}

}

+ 55
- 0
uitest/src/test/java/com/vaadin/tests/themes/valo/CollapsibleTableColumnTest.java Bestand weergeven

@@ -0,0 +1,55 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.themes.valo;

import java.util.List;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.elements.TableElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

/**
* Test for non-collapsible column opacity for item in column configuration
* menu.
*
* @author Vaadin Ltd
*/
public class CollapsibleTableColumnTest extends MultiBrowserTest {

@Test
public void nonCollapsibleColumnOpacity() {
openTestURL();

// click on the header to make the column selector visible
$(TableElement.class).first().getHeaderCell(0).click();
waitForElementVisible(By.className("v-table-column-selector"));

findElement(By.className("v-table-column-selector")).click();

List<WebElement> items = findElements(By.className("v-on"));
String collapsibleColumnOpacity = items.get(0).getCssValue("opacity");
String nonCollapsibleColumnOpacity = items.get(1)
.getCssValue("opacity");

Assert.assertNotEquals("Opacity value is the same for collapsible "
+ "and non-collapsible column item", collapsibleColumnOpacity,
nonCollapsibleColumnOpacity);
}
}

+ 46
- 0
uitest/src/test/java/com/vaadin/tests/themes/valo/DisabledLabelTest.java Bestand weergeven

@@ -0,0 +1,46 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.themes.valo;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.tests.tb3.MultiBrowserTest;

/**
* Test for disabled label opacity.
*
* @author Vaadin Ltd
*/
public class DisabledLabelTest extends MultiBrowserTest {

@Test
public void disabledLabelOpacity() {
openTestURL();

WebElement enabled = findElement(By.className("my-enabled"));
String enabledOpacity = enabled.getCssValue("opacity");

WebElement disabled = findElement(By.className("my-disabled"));
String disabledOpacity = disabled.getCssValue("opacity");

Assert.assertNotEquals(
"Opacity value is the same for enabled and disabled label",
enabledOpacity, disabledOpacity);
}
}

Laden…
Annuleren
Opslaan