use of org.xwiki.lesscss.internal.colortheme.DocumentColorThemeReference in project xwiki-platform by xwiki.
the class ColorThemeListenerTest method onEventWhenColorThemeChanged.
@Test
public void onEventWhenColorThemeChanged() throws Exception {
// Mocks
Event event = mock(Event.class);
XWikiDocument doc = mock(XWikiDocument.class);
Object data = new Object();
EntityReference classReference = new LocalDocumentReference("ColorThemes", "ColorThemeClass");
List<BaseObject> objects = new ArrayList<>();
BaseObject object = mock(BaseObject.class);
objects.add(object);
when(doc.getXObjects(classReference)).thenReturn(objects);
DocumentReference documentReference = new DocumentReference("wiki", "space", "page");
when(doc.getDocumentReference()).thenReturn(documentReference);
ColorThemeReference colorThemeReference = new DocumentColorThemeReference(documentReference, null);
when(colorThemeReferenceFactory.createReference(eq(documentReference))).thenReturn(colorThemeReference);
// Test
mocker.getComponentUnderTest().onEvent(event, doc, data);
// Verify
verify(lessResourcesCache).clearFromColorTheme(colorThemeReference);
verify(colorThemeCache).clearFromColorTheme(colorThemeReference);
}
use of org.xwiki.lesscss.internal.colortheme.DocumentColorThemeReference in project xwiki-platform by xwiki.
the class ColorThemeListenerTest method onEventWhenFlamingoThemeChanged.
@Test
public void onEventWhenFlamingoThemeChanged() throws Exception {
// Mocks
Event event = mock(Event.class);
XWikiDocument doc = mock(XWikiDocument.class);
Object data = new Object();
EntityReference classReference = new LocalDocumentReference("FlamingoThemesCode", "ThemeClass");
List<BaseObject> objects = new ArrayList<>();
BaseObject object = mock(BaseObject.class);
objects.add(object);
when(doc.getXObjects(classReference)).thenReturn(objects);
DocumentReference documentReference = new DocumentReference("wiki", "space", "page");
when(doc.getDocumentReference()).thenReturn(documentReference);
ColorThemeReference colorThemeReference = new DocumentColorThemeReference(documentReference, null);
when(colorThemeReferenceFactory.createReference(eq(documentReference))).thenReturn(colorThemeReference);
// Test
mocker.getComponentUnderTest().onEvent(event, doc, data);
// Verify
verify(lessResourcesCache).clearFromColorTheme(colorThemeReference);
verify(colorThemeCache).clearFromColorTheme(colorThemeReference);
}
Aggregations