huridocs/uwazi

View on GitHub
app/react/Templates/components/specs/__snapshots__/FormConfigRelationship.spec.js.snap

Summary

Maintainability
Test Coverage
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FormConfigRelationship when the fields are invalid and dirty or the form is submited should render the label with errors 1`] = `
<div>
  <div
    className="form-group has-error"
  >
    <label
      htmlFor="label"
    >
      <Connect(Translate)>
        Label
      </Connect(Translate)>
    </label>
    <Modeled(Connect(Field))
      model="template.data.properties[0].label"
    >
      <input
        className="form-control"
        id="label"
      />
    </Modeled(Connect(Field))>
  </div>
  <div
    className="form-group"
  >
    <label>
      <Connect(Translate)>
        Relationship
      </Connect(Translate)>
      <span
        className="required"
      >
        *
      </span>
    </label>
    <Select
      model="template.data.properties[0].relationType"
      options={
        Array [
          Object {
            "_id": 1,
            "name": "relationType1",
          },
          Object {
            "_id": 2,
            "name": "relationType2",
          },
        ]
      }
      optionsLabel="name"
      optionsValue="_id"
      validators={
        Object {
          "required": [Function],
        }
      }
    />
  </div>
  <div
    className="form-group"
  >
    <label>
      <Connect(Translate)>
        Entities
      </Connect(Translate)>
    </label>
    <Select
      model="template.data.properties[0].content"
      options={
        Array [
          Object {
            "_id": 3,
            "name": "Judge",
            "properties": Array [],
            "type": "template",
          },
        ]
      }
      optionsLabel="name"
      optionsValue="_id"
      placeholder="Any entity or document"
    />
  </div>
  <Connect(PropertyConfigOptions)
    canBeFilter={true}
    index={0}
    type="relationship"
  />
</div>
`;

exports[`FormConfigRelationship when the fields are invalid and dirty or the form is submited should render the label with errors when the form is submited 1`] = `
<div>
  <div
    className="form-group has-error"
  >
    <label
      htmlFor="label"
    >
      <Connect(Translate)>
        Label
      </Connect(Translate)>
    </label>
    <Modeled(Connect(Field))
      model="template.data.properties[0].label"
    >
      <input
        className="form-control"
        id="label"
      />
    </Modeled(Connect(Field))>
  </div>
  <div
    className="form-group"
  >
    <label>
      <Connect(Translate)>
        Relationship
      </Connect(Translate)>
      <span
        className="required"
      >
        *
      </span>
    </label>
    <Select
      model="template.data.properties[0].relationType"
      options={
        Array [
          Object {
            "_id": 1,
            "name": "relationType1",
          },
          Object {
            "_id": 2,
            "name": "relationType2",
          },
        ]
      }
      optionsLabel="name"
      optionsValue="_id"
      validators={
        Object {
          "required": [Function],
        }
      }
    />
  </div>
  <div
    className="form-group"
  >
    <label>
      <Connect(Translate)>
        Entities
      </Connect(Translate)>
    </label>
    <Select
      model="template.data.properties[0].content"
      options={
        Array [
          Object {
            "_id": 3,
            "name": "Judge",
            "properties": Array [],
            "type": "template",
          },
        ]
      }
      optionsLabel="name"
      optionsValue="_id"
      placeholder="Any entity or document"
    />
  </div>
  <Connect(PropertyConfigOptions)
    canBeFilter={true}
    index={0}
    type="relationship"
  />
</div>
`;

exports[`FormConfigRelationship when use as filter is selected should show the default filter option 1`] = `
<div>
  <div
    className="form-group"
  >
    <label
      htmlFor="label"
    >
      <Connect(Translate)>
        Label
      </Connect(Translate)>
    </label>
    <Modeled(Connect(Field))
      model="template.data.properties[0].label"
    >
      <input
        className="form-control"
        id="label"
      />
    </Modeled(Connect(Field))>
  </div>
  <div
    className="form-group"
  >
    <label>
      <Connect(Translate)>
        Relationship
      </Connect(Translate)>
      <span
        className="required"
      >
        *
      </span>
    </label>
    <Select
      model="template.data.properties[0].relationType"
      options={
        Array [
          Object {
            "_id": 1,
            "name": "relationType1",
          },
          Object {
            "_id": 2,
            "name": "relationType2",
          },
        ]
      }
      optionsLabel="name"
      optionsValue="_id"
      validators={
        Object {
          "required": [Function],
        }
      }
    />
  </div>
  <div
    className="form-group"
  >
    <label>
      <Connect(Translate)>
        Entities
      </Connect(Translate)>
    </label>
    <Select
      model="template.data.properties[0].content"
      options={
        Array [
          Object {
            "_id": 3,
            "name": "Judge",
            "properties": Array [],
            "type": "template",
          },
        ]
      }
      optionsLabel="name"
      optionsValue="_id"
      placeholder="Any entity or document"
    />
  </div>
  <Connect(PropertyConfigOptions)
    canBeFilter={true}
    index={0}
    type="relationship"
  />
</div>
`;