Skip to content

Commit

Permalink
fix text font on firefox, updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Jul 16, 2018
1 parent 9f21529 commit f51fcde
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 34 deletions.
4 changes: 2 additions & 2 deletions web/client/components/map/openlayers/VectorStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ const STYLE_TEXT = {
fontStyle: 'normal',
fontSize: '14',
fontSizeUom: 'px',
fontFamily: 'FontAwesome',
fontFamily: 'Arial',
fontWeight: 'normal',
font: "14px FontAwesome",
font: "14px Arial",
textAlign: 'center',
color: '#000000',
opacity: 1
Expand Down
8 changes: 4 additions & 4 deletions web/client/components/style/TextStyler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class TextStyler extends React.Component {
fontWeightValues: [{value: "normal"}, {value: "bold"}],
alignValues: [{value: "start", label: "left"}, {value: "center", label: "center"}, {value: "end", label: "right"}],
fontStyleValues: [{value: "normal"}, {value: "italic"}],
fontFamilyValues: [{value: "Arial"}, {value: "FontAwesome"}, {value: "Courier"}],
fontFamilyValues: [{value: "Arial"}, {value: "Helvetica"}, {value: "sans-serif"}, {value: "Courier"}],
shapeStyle: {},
setStyleParameter: () => {}
};

state = {
fontFamily: "FontAwesome"
fontFamily: "Arial"
};

render() {
Expand Down Expand Up @@ -98,15 +98,15 @@ class TextStyler extends React.Component {
</Col>
<Col xs={6} style={{position: 'static'}}>
<Combobox
value={this.state.fontFamily || "FontAwesome"}
value={this.state.fontFamily || "Arial"}
textField="value"
valueField="value"
messages={messages}
data={this.props.fontFamilyValues}
onChange={(e) => {
let fontFamily = e.value ? e.value : e;
if (fontFamily === "") {
fontFamily = "FontAwesome";
fontFamily = "Arial";
}
this.setState({fontFamily});
const font = createFont({...style, fontFamily});
Expand Down
4 changes: 2 additions & 2 deletions web/client/reducers/__tests__/mapInfo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1356,9 +1356,9 @@ describe('Test the mapInfo reducer', () => {
fontStyle: 'normal',
fontSize: '14',
fontSizeUom: 'px',
fontFamily: 'FontAwesome',
fontFamily: 'Arial',
fontWeight: 'normal',
font: '14px FontAwesome',
font: '14px Arial',
textAlign: 'center',
color: '#000000',
opacity: 1
Expand Down
20 changes: 10 additions & 10 deletions web/client/selectors/__tests__/annotations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ const state = {
}
},
Text: {
font: '14px FontAwesome',
font: '14px Arial',
color: '#1726E6',
weight: 1,
opacity: 1
Expand Down Expand Up @@ -285,9 +285,9 @@ const state = {
fontStyle: 'normal',
fontSize: '21',
fontSizeUom: 'px',
fontFamily: 'FontAwesome',
fontFamily: 'Arial',
fontWeight: 'normal',
font: 'normal normal 21px FontAwesome',
font: 'normal normal 21px Arial',
textAlign: 'center',
color: '#A424C0',
opacity: 1
Expand Down Expand Up @@ -381,9 +381,9 @@ const state = {
fontStyle: 'normal',
fontSize: '21',
fontSizeUom: 'px',
fontFamily: 'FontAwesome',
fontFamily: 'Arial',
fontWeight: 'normal',
font: 'normal normal 21px FontAwesome',
font: 'normal normal 21px Arial',
textAlign: 'center',
color: '#A424C0',
opacity: 1
Expand All @@ -402,9 +402,9 @@ const state = {
fontStyle: 'normal',
fontSize: '21',
fontSizeUom: 'px',
fontFamily: 'FontAwesome',
fontFamily: 'Arial',
fontWeight: 'normal',
font: 'normal normal 21px FontAwesome',
font: 'normal normal 21px Arial',
textAlign: 'center',
color: '#A424C0',
opacity: 1
Expand Down Expand Up @@ -523,13 +523,13 @@ describe('Test annotations selectors', () => {
expect(retVal.filter).toBe('');

});
it('test annotationsListSelector', () => {
it('test aeronauticalOptionsSelector', () => {
const retVal = aeronauticalOptionsSelector(state);
expect(retVal).toBe(undefined);

});
it('test annotationsListSelector with true value', () => {
const retVal = aeronauticalOptionsSelector({...state, aeronauticalOptions: true});
it('test aeronauticalOptionsSelector with true value', () => {
const retVal = aeronauticalOptionsSelector({annotations: {aeronauticalOptions: true}});
expect(retVal).toBe(true);

});
Expand Down
1 change: 1 addition & 0 deletions web/client/selectors/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const annotationSelector = createSelector([annotationsListSelector], (annotation
module.exports = {
annotationsLayerSelector,
annotationsInfoSelector,
aeronauticalOptionsSelector,
annotationsSelector,
annotationsListSelector,
annotationSelector,
Expand Down
6 changes: 3 additions & 3 deletions web/client/test-resources/Annotation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2311,8 +2311,8 @@
},
"Text": {
"color": "#000000",
"font": "14px FontAwesome",
"fontFamily": "FontAwesome",
"font": "14px Arial",
"fontFamily": "Arial",
"fontSize": "14",
"fontSizeUom": "px",
"fontStyle": "normal",
Expand All @@ -2324,4 +2324,4 @@
"type": "GeometryCollection"
},
"type": "Feature"
}
}
6 changes: 3 additions & 3 deletions web/client/utils/AnnotationsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const STYLE_TEXT = {
fontStyle: 'normal',
fontSize: '14',
fontSizeUom: 'px',
fontFamily: 'FontAwesome',
fontFamily: 'Arial',
fontWeight: 'normal',
font: "14px FontAwesome",
font: "14px Arial",
textAlign: 'center',
color: '#000000',
opacity: 1
Expand Down Expand Up @@ -273,7 +273,7 @@ const AnnotationsUtils = {
* it converts some props of a CSS-font into a shorhand form
* @return {string} a CSS-font
*/
createFont: ({fontSize = "14", fontSizeUom = "px", fontFamily = "FontAwesome", fontStyle = "normal", fontWeight = "normal"} = {}) => {
createFont: ({fontSize = "14", fontSizeUom = "px", fontFamily = "Arial", fontStyle = "normal", fontWeight = "normal"} = {}) => {
return `${fontStyle} ${fontWeight} ${fontSize}${fontSizeUom} ${fontFamily}`;
},
/**
Expand Down
17 changes: 7 additions & 10 deletions web/client/utils/__tests__/AnnotationsUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ describe('Test the AnnotationsUtils', () => {
expect(textParams.length).toBe(9);

const {font, color, opacity, fontStyle, fontSize, fontSizeUom, textAlign, fontFamily, fontWeight} = DEFAULT_ANNOTATIONS_STYLES.Text;
expect(font).toBe("14px FontAwesome");
expect(font).toBe("14px Arial");
expect(color).toBe("#000000");
expect(fontStyle).toBe("normal");
expect(fontWeight).toBe("normal");
expect(fontSize).toBe("14");
expect(fontFamily).toBe("FontAwesome");
expect(fontFamily).toBe("Arial");
expect(fontSizeUom).toBe("px");
expect(textAlign).toBe("center");
expect(opacity).toBe(1);
Expand Down Expand Up @@ -250,16 +250,14 @@ describe('Test the AnnotationsUtils', () => {
});
it('create font with values', () => {
// with defaults
expect(createFont({})).toBe("normal normal 14px FontAwesome");

expect(createFont({})).toBe("normal normal 14px Arial");
// with values
expect(createFont({fontFamily: "Courier"})).toBe("normal normal 14px Courier");
expect(createFont({fontSize: "30"})).toBe("normal normal 30px FontAwesome");
expect(createFont({fontSizeUom: "em"})).toBe("normal normal 14em FontAwesome");
expect(createFont({fontStyle: "italic"})).toBe("italic normal 14px FontAwesome");
expect(createFont({fontWeight: "bold"})).toBe("normal bold 14px FontAwesome");
expect(createFont({fontSize: "30"})).toBe("normal normal 30px Arial");
expect(createFont({fontSizeUom: "em"})).toBe("normal normal 14em Arial");
expect(createFont({fontStyle: "italic"})).toBe("italic normal 14px Arial");
expect(createFont({fontWeight: "bold"})).toBe("normal bold 14px Arial");
});

it('circlesToMultiPolygon', () => {
const {geometry, properties, style} = feature;
const f = circlesToMultiPolygon(geometry, properties, style.Circle);
Expand All @@ -269,7 +267,6 @@ describe('Test the AnnotationsUtils', () => {
expect(f.properties).toExist();
expect(f.properties.ms_style).toExist();
expect(f.properties.ms_style.strokeColor).toBe(style.Circle.color);

});
it('fromCircleToPolygon', () => {
const {geometry, properties} = circle1;
Expand Down

0 comments on commit f51fcde

Please sign in to comment.