String.format(
baseComponentTag,
"",
"<aura:attribute name='default' type='String' default='innie'/><aura:attribute name='both' type='String' default='outie' serializeTo='BOTH'/><aura:attribute name='server' type='String' default='lint' serializeTo='SERVER'/><aura:attribute name='none' type='String' default='holy' serializeTo='NONE'/>"));
Component cmp = Aura.getInstanceService().getInstance(desc);
Map<?, ?> attSet = (Map<?, ?>) new JsonReader().read(toJson(cmp.getAttributes()));
Map<?, ?> attSetValues = (Map<?, ?>) ((Map<?, ?>) attSet.get("value")).get("values");
assertEquals(2, attSetValues.size());
assertEquals("innie", attSetValues.get("default"));
assertEquals("outie", attSetValues.get("both"));
// set has no attributes with serializeTo == BOTH
desc = addSourceAutoCleanup(
ComponentDef.class,
String.format(
baseComponentTag,
"",
"<aura:attribute name='server' type='String' default='lint' serializeTo='SERVER'/><aura:attribute name='none' type='String' default='holy' serializeTo='NONE'/>"));
cmp = Aura.getInstanceService().getInstance(desc);
attSet = (Map<?, ?>) new JsonReader().read(toJson(cmp.getAttributes()));
attSetValues = (Map<?, ?>) ((Map<?, ?>) attSet.get("value")).get("values");
assertEquals(0, attSetValues.size());
}