Commit bacf6fc3 authored by Colin PUY's avatar Colin PUY

tr(handlebar) bump handlebar version to 4.0.6 (#2057)

- Bump handlerbar version to 4.0.6
- Fix templates according to new version
- Remove unused template
- Fix irrelevant test
parent 2a12e0fd
......@@ -13,7 +13,7 @@
<properties>
<jackson.version>2.5.0</jackson.version>
<handlebar.version>1.3.2</handlebar.version>
<handlebar.version>4.0.6</handlebar.version>
<spring.version>4.1.4.RELEASE</spring.version>
<aspectj.version>1.8.5</aspectj.version>
</properties>
......
angular.module('bonitasoft.ui.services').factory('{{name}}Factory', function() {
var resources = {};
{{#each resources}}
resources['{{ key }}'] = {{ json this }};
resources['{{ @key }}'] = {{ json this }};
{{/each}}
return {
get: function(uuid) {
......
......@@ -25,8 +25,11 @@ import static org.bonitasoft.web.designer.builder.PageBuilder.aPage;
import static org.bonitasoft.web.designer.builder.TabBuilder.aTab;
import static org.bonitasoft.web.designer.builder.TabsContainerBuilder.aTabsContainer;
import java.io.IOException;
import java.util.HashMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.bonitasoft.web.designer.model.page.Component;
import org.bonitasoft.web.designer.model.page.Page;
import org.bonitasoft.web.designer.model.page.PropertyValue;
......@@ -44,7 +47,7 @@ import org.mockito.runners.MockitoJUnitRunner;
public class PropertyValuesVisitorTest {
@Rule
public TestResource testResource;
public TestResource testResource = new TestResource(this.getClass());
@InjectMocks
private PropertyValuesVisitor propertyValuesVisitor;
......@@ -146,18 +149,11 @@ public class PropertyValuesVisitorTest {
@Test
public void should_generate_a_service_containing_parameter_values() throws Exception {
HashMap<String, PropertyValue> propertyValues = new HashMap<>();
PropertyValue propertyValue = new PropertyValue();
propertyValue.setType("bar");
propertyValue.setValue("baz");
propertyValues.put("foo", propertyValue);
Component component = aComponent().withPropertyValue("foo", "bar", "baz").build();
Component component = aComponent().withPropertyValue("foo", "bar", "baz").withReference("component-ref").build();
Page page = aPage().with(component).build();
assertThat(propertyValuesVisitor.generate(page))
.isEqualTo(new TemplateEngine("factory.hbs.js")
.with("name", "propertyValues")
.with("resources", singletonMap(component.getReference(), propertyValues)).build(this));
String service = propertyValuesVisitor.generate(page);
assertThat(service).isEqualTo(testResource.load("property-value-visitor.result.js"));
}
}
angular.module('bonitasoft.ui.services').factory('propertyValuesFactory', function() {
var identifiedPropertyValues = {};
{{#each identifiedPropertyValues}}
identifiedPropertyValues['{{ key }}'] = {{ json this }};
{{/each}}
var resources = {};
resources['component-ref'] = {"foo":{"type":"bar","value":"baz"}};
return {
get: function(uuid) {
return identifiedPropertyValues[uuid];
return resources[uuid];
}
};
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment