import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import { MetaItem } from './meta-item';

describe('MetaItem', () => {
  it('renders a label and a value', () => {
    const label = 'iusto';
    const value = 'autem';

    render(
      <dl>
        <MetaItem label={label} value={value} />
      </dl>
    );

    expect(rtlScreen.getByRole('term')).toHaveTextContent(label);
    expect(rtlScreen.getByRole('definition')).toHaveTextContent(value);
  });

  it('can render a label with multiple values', () => {
    const label = 'iusto';
    const values = [
      { id: 'autem', value: 'autem' },
      { id: 'quisquam', value: 'aut' },
      { id: 'molestias', value: 'voluptatem' },
    ];

    render(
      <dl>
        <MetaItem label={label} value={values} />
      </dl>
    );

    expect(rtlScreen.getByRole('term')).toHaveTextContent(label);
    expect(rtlScreen.getAllByRole('definition')).toHaveLength(values.length);
  });

  it('can render a centered group of label and values', () => {
    const label = 'iusto';
    const value = 'autem';

    render(
      <dl>
        <MetaItem isCentered label={label} value={value} />
      </dl>
    );

    expect(rtlScreen.getByRole('term').parentElement).toHaveClass(
      'item--centered'
    );
  });

  it('can render an inlined group of label and values', () => {
    const label = 'iusto';
    const value = 'autem';

    render(
      <dl>
        <MetaItem isInline label={label} value={value} />
      </dl>
    );

    expect(rtlScreen.getByRole('term').parentElement).toHaveClass(
      'item--inlined'
    );
  });

  it('can render a group of label and bordered values', () => {
    const label = 'iusto';
    const value = 'autem';

    render(
      <dl>
        <MetaItem hasBorderedValues label={label} value={value} />
      </dl>
    );

    expect(rtlScreen.getByRole('term').parentElement).toHaveClass(
      'item--bordered-values'
    );
  });

  it('can render a group of label and inlined values', () => {
    const label = 'iusto';
    const value = 'autem';

    render(
      <dl>
        <MetaItem hasInlinedValues label={label} value={value} />
      </dl>
    );

    expect(rtlScreen.getByRole('term').parentElement).toHaveClass(
      'item--inlined-values'
    );
  });
});
tion value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/www.armandphilippot.com/tree/?h=v2.0.0&amp;id=ee04742d1f0645908baa30e47845126c28848f50'>root</a>/<a href='/www.armandphilippot.com/tree/public?h=v2.0.0&amp;id=ee04742d1f0645908baa30e47845126c28848f50'>public</a>/<a href='/www.armandphilippot.com/tree/public/prism?h=v2.0.0&amp;id=ee04742d1f0645908baa30e47845126c28848f50'>prism</a>/<a href='/www.armandphilippot.com/tree/public/prism/prism-nsis.min.js?h=v2.0.0&amp;id=ee04742d1f0645908baa30e47845126c28848f50'>prism-nsis.min.js</a></div><div class='content'>blob: c85ecd14b5b308599c309f26e3d78a33b3920ce5 (<a href='/www.armandphilippot.com/plain/public/prism/prism-nsis.min.js?h=v2.0.0&amp;id=ee04742d1f0645908baa30e47845126c28848f50'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
<a id='n18' href='#n18'>18</a>
<a id='n19' href='#n19'>19</a>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
<a id='n23' href='#n23'>23</a>
<a id='n24' href='#n24'>24</a>
<a id='n25' href='#n25'>25</a>
</pre></td>
<td class='lines'><pre><code>