Browse Source

Merge changes from origin/7.1

d0bc54b Prevent popup open when datafield is disabled (#13508).

Change-Id: I3f15fa2d0774dfa0c91312d79822be94afcb0d34
tags/7.2.0.beta1
Build Agent 10 years ago
parent
commit
9422946a40

+ 2
- 1
WebContent/VAADIN/themes/base/datefield/datefield.scss View File

@@ -56,7 +56,8 @@
border: 1px solid #ddd;
}
.v-disabled .#{$primaryStyleName}-calendarpanel-day,
.v-disabled .#{$primaryStyleName}-calendarpanel-day-today {
.v-disabled .#{$primaryStyleName}-calendarpanel-day-today,
.v-disabled.#{$primaryStyleName}-popupcalendar .#{$primaryStyleName}-button {
cursor: default;
}
.#{$primaryStyleName}-calendarpanel-day-disabled,

+ 1
- 1
client/src/com/vaadin/client/ui/VPopupCalendar.java View File

@@ -330,7 +330,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
*/
public void openCalendarPanel() {

if (!open && !readonly) {
if (!open && !readonly && isEnabled()) {
open = true;

if (getCurrentDate() != null) {

+ 46
- 0
uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopup.java View File

@@ -0,0 +1,46 @@
/*
* Copyright 2000-2013 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.components.datefield;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.DateField;

/**
*
* @since 7.1
* @author Vaadin Ltd
*/
public class DisabledDateFieldPopup extends AbstractTestUI {

@Override
protected void setup(VaadinRequest request) {
DateField field = new DateField();
field.setEnabled(false);
addComponent(field);
}

@Override
protected String getTestDescription() {
return "Don't open popup calendar if datefield is disabled";
}

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

}

+ 52
- 0
uitest/src/com/vaadin/tests/components/datefield/DisabledDateFieldPopupTest.java View File

@@ -0,0 +1,52 @@
/*
* Copyright 2000-2013 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.components.datefield;

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

import com.vaadin.tests.tb3.MultiBrowserTest;

/**
*
* @since 7.1
* @author Vaadin Ltd
*/
public class DisabledDateFieldPopupTest extends MultiBrowserTest {

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

WebElement button = driver.findElement(By
.className("v-datefield-button"));
button.click();

Assert.assertFalse(
"Calendar popup should not be opened for disabled date field on mouse click",
isElementPresent(By.className("v-datefield-popup")));

button.sendKeys(Keys.ARROW_DOWN);

Assert.assertFalse("Calendar popup should not be opened for "
+ "disabled date fild on down key",
isElementPresent(By.className("v-datefield-popup")));

}
}

Loading…
Cancel
Save