Skip to content

Commit fe8e2c6

Browse files
chrisalatemi
authored andcommitted
Added functional test for the image data type #49
1 parent 61be0fe commit fe8e2c6

File tree

6 files changed

+83
-9
lines changed

6 files changed

+83
-9
lines changed

grails-app/conf/BuildConfig.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ clover {
3535
}
3636
}
3737
}
38-
ant.'clover-check'(target: "52%", haltOnFailure: true) { }
38+
ant.'clover-check'(target: "52.5%", haltOnFailure: true) { }
3939

4040
}
4141
}
341 KB
Loading
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"images": {
2+
"images1": {
33
"documentId": "d1"
4+
},
5+
"images2": {
6+
"documentId": "d2"
47
}
58
}

grails-app/conf/example_models/images.json

+29-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,38 @@
33
{
44
"dataType": "image",
55
"description": "",
6-
"name": "images"
6+
"name": "images1"
7+
},{
8+
"dataType": "image",
9+
"description": "",
10+
"name": "images2"
711
}
812
],
913
"modelName": "Images Example",
1014
"viewModel": [
1115
{
12-
"title": "Images:",
13-
"source": "images",
14-
"type": "image"
15-
}]
16+
"type": "row",
17+
"items": [
18+
{
19+
"type": "col",
20+
"items": [
21+
{
22+
"preLabel": "Always visible metadata:",
23+
"source": "images1",
24+
"type": "image",
25+
"displayOptions": {
26+
"metadataAlwaysVisible": true
27+
}
28+
},
29+
{
30+
"preLabel": "Default metadata behaviour:",
31+
"source": "images2",
32+
"type": "image"
33+
}
34+
]
35+
}
36+
]
37+
}
38+
39+
]
1640
}

grails-app/views/preview/index.gsp

+19-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
var output = {};
8181
<g:if test="${data}">
8282
var outputData = JSON.parse('${data.encodeAsJavaScript()}');
83-
outputt.data = outputData;
83+
output.data = outputData;
8484
</g:if>
8585
8686
var context = {
@@ -92,7 +92,24 @@
9292
{
9393
documentId:'d1',
9494
url:fcConfig.imagePreviewUrl+'/Landscape_1.jpg',
95-
thumbnailUrl:fcConfig.imagePreviewUrl+'/Landscape_1.jpg'
95+
thumbnailUrl:fcConfig.imagePreviewUrl+'/Landscape_1.jpg',
96+
"name": "Test image 1",
97+
"attribution": "Test attribution 1",
98+
"notes": "test notes 1",
99+
filename:"Landscape_1.jpg",
100+
filesize:1000
101+
102+
},
103+
{
104+
documentId:'d2',
105+
url:fcConfig.imagePreviewUrl+'/Landscape_2.jpg',
106+
thumbnailUrl:fcConfig.imagePreviewUrl+'/Landscape_2.jpg',
107+
"name": "Test image 2",
108+
"attribution": "Test attribution 2",
109+
"notes": "Test notes 2",
110+
filename:"Landscape_2.jpg",
111+
filesize:1000
112+
96113
}
97114
]
98115
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package au.org.ala.ecodata.forms
2+
3+
import geb.spock.GebReportingSpec
4+
import pages.PreviewPage
5+
6+
class ImageTypeSpec extends GebReportingSpec {
7+
8+
def "The default behaviour of the view mode of the image view type is to show metadata on hover"() {
9+
when:
10+
to ([name:'images', mode:'view'], PreviewPage)
11+
12+
then:
13+
title == "Preview Images Example"
14+
15+
when: "We hover over the photo"
16+
interact {
17+
moveToElement($('[data-bind*=images2]'))
18+
}
19+
20+
then: "A popover is displayed containing the photo metadata"
21+
waitFor {
22+
$('.popover').displayed
23+
}
24+
and: "the photo metadata is displayed correctly"
25+
$(".popover span[data-bind*=name]").text() == "Test image 2"
26+
$(".popover span[data-bind*=attribution]").text() == "Test attribution 2"
27+
$(".popover span[data-bind*=notes]").text() == "Test notes 2"
28+
29+
}
30+
}

0 commit comments

Comments
 (0)