Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1036] CustomTSS: Comma-separated queries are using wrong operator AND instead of OR

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-06-10T17:37:26.000+0000
Affected Version/sAlloy 1.4.0
Fix Version/sAlloy 1.5.0
ComponentsStyling
Labelsqe-closed-3.4.0, qe-manualtest, qe-testadded, styling
ReporterFederico Casali
AssigneeTim Poulsen
Created2014-06-03T00:27:00.000+0000
Updated2014-08-20T10:04:02.000+0000

Description

Problem description

CustomTSS comma-separated queries are not correctly applied since the boolean operator used in this case is an AND instead of an OR.

Steps to reproduce

Sample code

// index.xml
<Alloy>
	<Window>
		<Label class="classLabel" id="testLabel"/>
	</Window>
</Alloy>
// app.tss
"Label":{
	font:{
		fontSize:'22dp'
	},
	color:'purple'
}

".classLabel":{
	text:"Simple class label applied"
}

".classLabel[platform=ios,android formFactor=tablet,handheld if=Alloy.Globals.custom1,Alloy.Globals.custom2]":{
	text:"iOS or Android! Styles conditionals correctly applied"
}
// alloy.js
Alloy.Globals.custom1 = true;
Alloy.Globals.custom2 = false;

Steps

1. Run the sample code either on iOS or Android Result: Label text is "Simple class label applied" Expected result: Label text should be "iOS or Android! Styles conditionals correctly applied" Style conditional is not satisfied as custom2 is false and "if=Alloy.Globals.custom1,Alloy.Globals.custom2" returns false (should be true). 2. Change "Alloy.Globals.custom2" from false to true. Run on either iOS or Android. Result: Label text is "iOS or Android! Styles conditionals correctly applied", since both are true and the AND operator returns true.

Comments

  1. Tim Poulsen 2014-06-10

    PR https://github.com/appcelerator/alloy/pull/442 Test app: Use https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-1036 Functional test 1. Build the the 1036 test app. You should see two labels: the first to say "iOS or Android! Styles conditionals correctly applied" and the second to say "Add in XML" 2. Modify alloy.js setting both global variables true. The build the app. You should see the same two labels. 3. Modify alloy.js setting both global variables false. The build the app. You should see just one label with the text "Simple class label applied". 4. Build the https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/custom_tss_queries app. It should run without errors and apply styles as described by the alloy.js and TSS classes.
  2. Tim Poulsen 2014-06-10

    Reopening to adjust time
  3. Tim Poulsen 2014-06-10

    Re-resolving with updated time
  4. Priya Agarwal 2014-08-20

    Verified with: Appc Studio - 3.4.0.201408180158 SDK - 3.4.0.v20140819094113 acs - 1.0.16 alloy - 1.5.0-dev npm - 1.3.2 titanium - 3.4.0-dev titanium-code-processor - 1.1.1 OS - mavericks (v10.9.4) Xcode - 6Beta5 Device - iPhone5s(v8.0), Nexus7(v4.4.4) Tested both the apps (test/apps/testing/ALOY-1036 and https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/custom_tss_queries). Both apps run without error and as expected. Hence closing the issue.

JSON Source