From 1d6c3abf8117126374d25ec67c3ab6b21b91c00b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Sat, 1 Feb 2020 15:17:09 +0100 Subject: [PATCH] docs: clarify how queryBy behaves --- docs/Queries.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/Queries.md b/docs/Queries.md index db7549bce..3264bdd33 100644 --- a/docs/Queries.md +++ b/docs/Queries.md @@ -10,24 +10,19 @@ title: Queries ### getBy -`getBy*` queries returns the first matching node for a query, and throws an -error if no elements match. +`getBy*` queries return the first matching node for a query, and throw an error if no elements match or if more than one match is found (use `getAllBy` instead). ### getAllBy -`getAllBy*` queries return an array of all matching nodes for a query, and -throws an error if no elements match. +`getAllBy*` queries return an array of all matching nodes for a query, and throw an error if no elements match. ### queryBy -`queryBy*` queries returns the first matching node for a query, and return -`null` if no elements match. This is useful for asserting an element is not -present. +`queryBy*` queries return the first matching node for a query, and return `null` if no elements match. This is useful for asserting an element that is not present. This throws if more than one match is found (use `queryAllBy` instead). ### queryAllBy -`queryAllBy*` queries return an array of all matching nodes for a query, and -return an empty array (`[]`) if no elements match. +`queryAllBy*` queries return an array of all matching nodes for a query, and return an empty array (`[]`) if no elements match. ## Queries