use of org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration in project webtools.sourceediting by eclipse.
the class TestCSSDecl method testStandaloneCSSDecl.
// commenting out this test because decl.setCssText() is not an implemented method
// public void testDecl() {
// CSSPropertyContext context = new CSSPropertyContext();
// ICSSStyleDeclaration decl = CSSStyleDeclarationFactory.getInstance().createStyleDeclaration();
// context.initialize(decl);
// decl.setCssText(getString() != null ? getString() : "");//$NON-NLS-1$
// }
// private String getString() {
// return "body {}";
// }
public void testStandaloneCSSDecl() {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=202615
CSSPropertyContext context = new CSSPropertyContext();
ICSSStyleDeclaration decl = CSSStyleDeclarationFactory.getInstance().createStyleDeclaration();
context.initialize(decl);
String cssText = decl.getCssText();
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("standalone css node was not initialized", "", cssText);
// $NON-NLS-1$
context.setMargin("auto");
// $NON-NLS-1$
context.setColor("red");
// $NON-NLS-1$
context.setBorder("thick");
context.applyFull(decl);
cssText = decl.getCssText();
// $NON-NLS-1$
String expected = "color: red; border: thick; margin: auto";
// $NON-NLS-1$
assertEquals("standalone css node's properties were not set as expected", expected, cssText);
}
Aggregations