I created a component that has a required attribute of array type, ListCmp.cmp:

  <aura:attribute name="items" type="Object[]" required="true" />

    <ul class="slds-list_vertical>
      <aura:if isTrue="{!v.items.length}">
        <aura:iteration items="{!v.items}" var="item">
          <li class="slds-list__item">
        <aura:set attribute="else">

and a parent component that I using the ListCmp component without providing the required attribute
<c:ListCmp />. Instead of getting an error I am getting the empty result rendered same as providing and empty array <c:ListCmp items="[]"/>


Jasmine test passes - correctly fails to create component without the required attribute:

it('does not renders', function(done) {
  $T.createComponent('c:ListCmp', {}, true)
    .then(function(component) {
    .catch(function(e) {
  • This could be a bug. If I use a parent/child combination with a required attribute in child and that I embed the parent in an app, the components fail to render if I don't provide the child attribute in parent. However using the components say on a Home Page, just works fine. You may like to reach out to SF support. – Jayant Das Feb 27 '19 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.