     $('.echoforms-element-text').val('bar').click()
     expect(form.echoforms('serialize')).not.toMatch(/dynamicNode/)
 
-  it "relevancy takes precedence over required", ->
+  it "removes from output any irrelevant but required nodes", ->
     model = """
       <prov:treeReference type="tree">
         <prov:data_layer></prov:data_layer>

        <prov:data_layer>/GLAH01/Data_1HZ_VAL/Engineering</prov:data_layer>
      </prov:treeReference>
    """
    it "should select all child nodes of selected node when cascade = true", ->
      attrs = 'ref="prov:treeReference" valueElementName="data_layer" separator="\/" cascade="true"'
      form = template.form(dom, model: model, attributes: attrs)
      $(':jstree').jstree('open_all')

    template.form(dom, model: model, attributes: attrs)
    expect($('.jstree-clicked').parent().attr('node_value')).toBe("/GLAH01/Data_1HZ_VAL/Engineering/d_T_detID_VAL");

  describe "'irrelevant' nodes", ->
    beforeEach ->
      model = """
        <prov:treeReference type="tree">
          <prov:data_layer></prov:data_layer>
        </prov:treeReference>
      """
      children = """
        <item value="irrelevantNode" relevant="false()"/>
        <item value="relevantNode" relevant="true()"/>
      """
      @form = template.form(dom, model: model, attributes: attrs, children: children)

    it "does not allow irrelevant nodes to be selected", ->
      $(":jstree li[node_value = '/irrelevantNode'] > a ").each ->
        $(this).click()
      $(":jstree li[node_value = '/relevantNode'] > a ").each ->
        $(this).click()
      expect($('.jstree-clicked').parent().attr('node_value')).not.toMatch("irrelevantNode");
      expect($('.jstree-clicked').parent().attr('node_value')).toMatch("relevantNode");
      expect(@form.echoforms('serialize')).not.toMatch(/irrelevantNode/)
      expect(@form.echoforms('serialize')).toMatch(/relevantNode/)

    it "displays a '[not available]' message", ->
      expect($(":jstree li[node_value = '/irrelevantNode'] span.echoforms-help ").text()).toMatch("[not available]")

    it "removes the checkbox", ->
      expect($(":jstree li[node_value = '/irrelevantNode'] i.jstree-icon")).not.toHaveClass("jstree-checkbox")

    it "adds a check mark icon", ->
      expect($(":jstree li[node_value = '/irrelevantNode'] i.jstree-icon")).toHaveClass("jstree-disabled-icon")

    it "sets the item-relevant attribute to false", ->
      expect($(":jstree li[node_value = '/irrelevantNode']")).toHaveAttr("item-relevant","false")

  it "excludes from output any preselected nodes which are not relevant", ->
    model = """
