Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,20 @@
</differences>
</revapi.differences>
-->

<revapi.differences>
Comment thread
Sereza5 marked this conversation as resolved.
Resolved
<differences>
<item>
<ignore>true</ignore>
<regex>true</regex>
<code>java\.annotation\.added</code>
<old>method void org\.xwiki\.rendering\.macro\.box\.BoxMacroParameters::setCssClass\(java\.lang\.String\).*</old>
<new>method void org\.xwiki\.rendering\.macro\.box\.BoxMacroParameters::setCssClass\(java\.lang\.String\).*</new>
<annotation>@org\.xwiki\.properties\.annotation\.PropertyAdvanced</annotation>
<criticality>allowed</criticality>
<justification>Binary compatible, only marks the parameter as advanced in the macro descriptor, including where MessageMacroParameters inherits it</justification>
</item>
</differences>
</revapi.differences>
</analysisConfiguration>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.xwiki.properties.annotation.PropertyAdvanced;
import org.xwiki.properties.annotation.PropertyDescription;
import org.xwiki.properties.annotation.PropertyDisplayType;
import org.xwiki.properties.annotation.PropertyHidden;
Expand Down Expand Up @@ -131,6 +132,7 @@ public String getCssClass()
* @param cssClass refer to {@link BoxMacroParameters#getCssClass()}
*/
@PropertyDescription("A CSS class to add to the box element")
@PropertyAdvanced
public void setCssClass(String cssClass)
{
this.cssClass = cssClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.rendering.macro.box;

import org.junit.jupiter.api.Test;
import org.xwiki.rendering.macro.Macro;
import org.xwiki.test.annotation.AllComponents;
import org.xwiki.test.junit5.mockito.ComponentTest;
import org.xwiki.test.junit5.mockito.InjectComponentManager;
import org.xwiki.test.mockito.MockitoComponentManager;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Unit tests for the descriptor of the Box macro.
*
* @version $Id$
*/
@AllComponents
@ComponentTest
class BoxMacroTest
{
@InjectComponentManager
private MockitoComponentManager componentManager;

@Test
void cssClassParameterIsAdvanced() throws Exception
{
Macro<BoxMacroParameters> boxMacro = this.componentManager.getInstance(Macro.class, "box");

assertTrue(boxMacro.getDescriptor().getParameterDescriptorMap().get("cssclass").isAdvanced());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.List;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.xwiki.rendering.block.Block;
import org.xwiki.rendering.block.RawBlock;
import org.xwiki.rendering.macro.Macro;
Expand Down Expand Up @@ -82,6 +84,15 @@ void macroContentDescriptorIsNotNull() throws Exception
assertNotNull(messageMacro.getDescriptor().getContentDescriptor());
}

@ParameterizedTest
@ValueSource(strings = { "info", "warning", "error", "success" })
void cssClassParameterIsAdvanced(String macroName) throws Exception
{
Macro<MessageMacroParameters> messageMacro = this.componentManager.getInstance(Macro.class, macroName);

assertTrue(messageMacro.getDescriptor().getParameterDescriptorMap().get("cssclass").isAdvanced());
}

@Test
void executeWithRawBlockForIconBlock() throws Exception
{
Expand Down
Loading