[ALOY-789] Improperly escaping line terminators
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-08-15T15:29:40.000+0000 |
Affected Version/s | Alloy 1.2.0 |
Fix Version/s | Alloy 1.2.1, 2013 Sprint 17 |
Components | Runtime, Styling |
Labels | qe-testadded |
Reporter | Tony Lukasavage |
Assignee | Tony Lukasavage |
Created | 2013-08-15T14:40:59.000+0000 |
Updated | 2013-08-28T23:40:19.000+0000 |
Description
When creating runtime styles, the styler.js module is improperly escaping certain escape sequences, most notably line terminators. The following line in a TSS file:
text: 'this is a \nlinebreak'
is actually rendering the line break in the generated code, instead of preserving the given text string. The line terminators that should specifically be handled are listed here:
http://es5.github.io/#x7.3
Comments
- Tony Lukasavage 2013-08-15
commit: https://github.com/appcelerator/alloy/commit/1f0e84a68f8e5b56a464b6d968f6965257e0b358
Functional test should be performed on the 1_2_X branch:
And here are the steps:sudo npm install -g git://github.com/appcelerator/alloy.git#1_2_X
Create a default alloy app
Set the index.xml like this:
<Alloy> <Window class="container"> <Label id="label" onClick="doClick"/> </Window> </Alloy>
Set the index.tss like this:
".container": { backgroundColor:"white" } "Label": { width: Ti.UI.SIZE, height: Ti.UI.SIZE, color: "#000", text: "I have a \ntab" }
Run the app
Ensure that the generated "Resources/alloy/styles/index.js" file has no rendered line breaks in it.
Package the app for Android. Ensure that is executes successfully.
- Tony Lukasavage 2013-08-15 Another confirmation that this was resolved is in the duplicate ALOY-790
- Olga Romero 2013-08-19 Tested the above code with: Appcelerator Studio, build: 3.1.2.201308091728 Titanum SDK, build:3.1.3.v20130816184556 Alloy: 1.2.1-cr CLI: 3.1.2 Device: Galaxy Note2 Android version: 4.1.2 Followed test steps successfully.
- Thierry Ruiz 2013-08-28 However, now when I use a line break into a view.xml file (example below) the line break code is not interpreted anymore and considered/showed as part of the main string. (Tested on iPhone Simulator)
- Thierry Ruiz 2013-08-28 Turn out that using this coding way (instead of the one above), it works: