{"_id":"@dom-assertions/chai-dom","name":"@dom-assertions/chai-dom","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dom-assertions/chai-dom","version":"0.1.0","description":"Chai assertions for testing DOM elements","author":{"name":"Mohammad Ataei","email":"mammadataei@gmail.com"},"license":"MIT","keywords":["testing","dom","chai","chai-dom","assertions","accessible","accessibility"],"repository":{"type":"git","url":"git+https://github.com/mammadataei/dom-assertions.git","directory":"packages/chai-dom"},"bugs":{"url":"https://github.com/mammadataei/dom-assertions/issues"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"dependencies":{"dom-assertions":"^0.1.0"},"scripts":{"build":"tsc && tsup","test":"vitest --ui --open=false","test:coverage":"vitest run --coverage","format":"prettier --write .","lint":"eslint --ext .js,.jsx,.ts,.tsx ."},"homepage":"https://github.com/mammadataei/dom-assertions#readme","_id":"@dom-assertions/chai-dom@0.1.0","_integrity":"sha512-BnKzdWvihqaqp5ev9sfx+GBmHI/sWObk/nLyfHdYFKQ3PMrsjjFY0v0LQml19VgguI32nFHzPU1c6ATPtBbvwQ==","_resolved":"/private/var/folders/ws/j9p7qptn3dl9lq7ys32rjcjc0000gn/T/647b443785cec5061af8df90aa62bb3c/dom-assertions-chai-dom-0.1.0.tgz","_from":"file:dom-assertions-chai-dom-0.1.0.tgz","_nodeVersion":"18.6.0","_npmVersion":"8.13.2","dist":{"integrity":"sha512-BnKzdWvihqaqp5ev9sfx+GBmHI/sWObk/nLyfHdYFKQ3PMrsjjFY0v0LQml19VgguI32nFHzPU1c6ATPtBbvwQ==","shasum":"a627ee7ccb8f245d384ae616ed2b1583e35700c7","tarball":"https://registry.npmjs.org/@dom-assertions/chai-dom/-/chai-dom-0.1.0.tgz","fileCount":6,"unpackedSize":15509,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDf0vO52DRZ4koPlwWq3N3xVYNg5VQJHQhnMJAo0iaS+QIhALSwfNdE6/JrYUeTLRCtjZVlJfR6xlsnr8XEYjgJQ/2S"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2kZoACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmol1Q/+NUrao598uPnIBPxEO9EKU8YVjZbcUPSU7901oEwPs4/k/Aiw\r\ncIJ8e8EDAkBV0sDkbSw0vpoIAX9cii8VwazoJJUxZwMbJonWx/UzL3zQYcoX\r\njvMJ/hBZcObJZQrF50KvjQFnHZ3K+WmtEqMsi/13/7eyA1h7VZYGpUo1bjQO\r\nPCT/VHc95Db5II++LOhgQpDlo/yQltLN5q5mp29gvJXnvBRLNyPSPRdn5b0o\r\nUHo8bB452JfCEKPxlEADYFRfCG4Wo7BEXKxv9OwzFOxNWWF7jV8NN8nILWZM\r\nNgvuHrujWK1lhl88tDoKouPWWUZ2z92KDfeqjWUn0SshwUcjJG+X6Ck8K1G9\r\nUmniv5QgT/5YP/o8B1ZyH6iqy1DuiPRer9YnfGRMY5ySbDQ35tVyO6m0LNdy\r\n7ogyt0EN8lOj9XRV/7vMdVLLBtnDKaMSzLJaeBHgEqS/W4bINDlSheHzCfFa\r\nA9+zABIR9qldPm+IDsIoHtpzVvYn4zGR5Fvh1gS3ymbXtgc/S9pTafjIrkVp\r\n4cxd+e3RIrsUblh7oC18gHki134HzdlV2nIQJxQ82AodBIJKItYgr2K2J7iJ\r\nD0RaaDhcH1BLSym7Aq2or7uHCOhPJQVbA9CyG2cSCRjKNLfESlILx8wCNDTe\r\nOUqPYoxwWwmdLcoZ6MQmMLpH59H/PpHPHYM=\r\n=rr4z\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"mammadataei","email":"mammadataei@gmail.com"},"directories":{},"maintainers":[{"name":"mammadataei","email":"mammadataei@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chai-dom_0.1.0_1658472040344_0.7855960483122473"},"_hasShrinkwrap":false}},"time":{"created":"2022-07-22T06:40:40.249Z","0.1.0":"2022-07-22T06:40:40.536Z","modified":"2022-07-22T06:40:40.677Z"},"maintainers":[{"name":"mammadataei","email":"mammadataei@gmail.com"}],"description":"Chai assertions for testing DOM elements","homepage":"https://github.com/mammadataei/dom-assertions#readme","keywords":["testing","dom","chai","chai-dom","assertions","accessible","accessibility"],"repository":{"type":"git","url":"git+https://github.com/mammadataei/dom-assertions.git","directory":"packages/chai-dom"},"author":{"name":"Mohammad Ataei","email":"mammadataei@gmail.com"},"bugs":{"url":"https://github.com/mammadataei/dom-assertions/issues"},"license":"MIT","readme":"<div align=\"center\">\n\n<h1>@dom-assertions/chai-dom</h1>\n\n<p>Custom chai assertions for testing DOM elements.</p>\n\n</div>\n\nThe `@dom-assertions/chai-dom` package provides custom\n[Chai](https://chaijs.com/) assertions for writing more declarative, readable,\nand maintainable tests.\n\n## Installation\n\nFirst, install the `@dom-assertions/chai-dom` package.\n\n```sh\nnpm install --save-dev @dom-assertions/chai-dom\n\nyarn add --dev @dom-assertions/chai-dom\n\npnpm add --save-dev @dom-assertions/chai-dom\n```\n\nThen:\n\n```ts\nimport ChaiDom from '@dom-assertions/chai-dom'\n\nchai.use(ChaiDom)\n```\n\n## Assertions\n\n### `be.invalid`\n\nAsserts that the given element is invalid.\n\n#### Example\n\n```html\n<div>\n  <label for=\"username\">Username</label>\n  <input id=\"username\" type=\"text\" aria-invalid=\"true\" />\n</div>\n```\n\n```tsx\nexpect(username).to.be.invalid\n```\n\n### `be.required`\n\nAsserts that the given element is required.\n\n#### Example\n\n```html\n<div>\n  <label for=\"username\">Username</label>\n  <input id=\"username\" type=\"text\" required />\n</div>\n```\n\n```tsx\nexpect(username).to.be.required\n```\n\n### `be.valid`\n\nAsserts that the given element is valid.\n\n#### Example\n\n```html\n<div>\n  <label for=\"username\">Username</label>\n  <input id=\"username\" type=\"text\" />\n</div>\n```\n\n```tsx\nexpect(username).to.be.valid\n```\n\n### `have.description`\n\nAsserts that the given element has the expected\n[accessible description](https://w3c.github.io/accname/).\n\n#### Example\n\n```html\n<button aria-describedby=\"trash-desc\">Move to trash</button>\n<p id=\"trash-desc\">\n  Items in the trash will be permanently removed after 30 days.\n</p>\n```\n\n```tsx\nexpect(button).to.have.description()\nexpect(button).to.have.description(\n  'Items in the trash will be permanently removed after 30 days.',\n)\n```\n\n### `have.errorMessage`\n\nAsserts that the given element has the expected\n[ARIA error message](https://www.w3.org/TR/wai-aria/#aria-errormessage). Please\nnote that the element should indicate an error state using `aria-invalid` set to\n`true`.\n\n#### Example\n\n```html\n<label for=\"email\">Email</label>\n<input\n  type=\"email\"\n  name=\"email\"\n  id=\"email\"\n  aria-invalid=\"true\"\n  aria-errormessage=\"error-message\"\n/>\n<span id=\"error-message\">Enter a valid email address</span>\n```\n\n```tsx\nexpect(email).to.have.errorMessage()\nexpect(email).to.have.errorMessage('Enter a valid email address')\n```\n\n### `have.name`\n\nAsserts that the given element has the expected\n[accessible name](https://w3c.github.io/accname/).\n\n#### Example\n\n```html\n<span\n  role=\"checkbox\"\n  aria-checked=\"false\"\n  tabindex=\"0\"\n  aria-labelledby=\"label\"\n/>\n<span id=\"label\">I agree to the Terms and Conditions.</span>\n```\n\n```tsx\nexpect(checkbox).to.have.name()\nexpect(checkbox).to.have.name('I agree to the Terms and Conditions.')\n```\n","readmeFilename":"README.md"}