1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.test.ui.po.editor

File ClassPropertyEditPane.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
11
4
1
95
33
5
0.45
2.75
4
1.25

Classes

Class Line # Actions
ClassPropertyEditPane 32 11 0% 5 0
1.0100%
 

Contributing tests

This file is covered by 8 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.test.ui.po.editor;
21   
22    import org.openqa.selenium.By;
23    import org.xwiki.test.ui.po.BaseElement;
24    import org.xwiki.test.ui.po.FormElement;
25   
26    /**
27    * Represents the pane used to edit a class property.
28    *
29    * @version $Id: ce6e46223326edce2e6becca6b29adda69683735 $
30    * @since 4.5
31    */
 
32    public class ClassPropertyEditPane extends BaseElement
33    {
34    /**
35    * The class editor form.
36    */
37    private final FormElement form;
38   
39    /**
40    * The edited property.
41    */
42    private final String propertyName;
43   
44    /**
45    * Creates a new pane that can be used to set the meta-properties of the specified XClass property.
46    *
47    * @param form the class editor form
48    * @param propertyName the name of the edited property
49    */
 
50  23 toggle public ClassPropertyEditPane(FormElement form, String propertyName)
51    {
52  23 this.form = form;
53  23 this.propertyName = propertyName;
54    }
55   
56    /**
57    * Expands this property pane so that the meta-properties are visible and thus editable.
58    *
59    * @return this
60    */
 
61  23 toggle public ClassPropertyEditPane expand()
62    {
63  23 By containerLocator = By.id("xproperty_" + propertyName);
64  23 By titleLocator = By.id("xproperty_" + propertyName + "_title");
65  23 getDriver().waitUntilElementIsVisible(containerLocator);
66  23 if (getDriver().findElementWithoutWaiting(containerLocator).getAttribute("class").contains("collapsed")) {
67  18 getDriver().findElementWithoutWaiting(titleLocator).click();
68    }
69  23 return this;
70    }
71   
72    /**
73    * Sets a meta property of the edited XClass property.
74    *
75    * @param metaPropertyName the name of the meta-property
76    * @param value the value to set
77    * @return this
78    */
 
79  15 toggle protected ClassPropertyEditPane setMetaProperty(String metaPropertyName, String value)
80    {
81  15 form.setFieldValue(By.id(propertyName + "_" + metaPropertyName), value);
82  15 return this;
83    }
84   
85    /**
86    * Sets the pretty name of the edited property.
87    *
88    * @param prettyName the new pretty name
89    * @return this
90    */
 
91  2 toggle public ClassPropertyEditPane setPrettyName(String prettyName)
92    {
93  2 return setMetaProperty("prettyName", prettyName);
94    }
95    }