From 6c8bccd4a0cb673b7a10b202d2ae62d6f5db65f1 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Wed, 10 Oct 2018 16:35:55 -0700 Subject: [PATCH] feat(labels): add support for aria-labelledby --- .size-snapshot.json | 6 +++--- README.md | 8 +++++++- src/__tests__/element-queries.js | 23 ++++++++++++++++++++++- src/queries.js | 23 ++++++++++++++++++++++- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/.size-snapshot.json b/.size-snapshot.json index 094d20cb..a5e568a4 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,7 +1,7 @@ { "dist/dom-testing-library.umd.js": { - "bundled": 115443, - "minified": 50960, - "gzipped": 15294 + "bundled": 122519, + "minified": 52052, + "gzipped": 15632 } } diff --git a/README.md b/README.md index 73699dc2..31a69112 100644 --- a/README.md +++ b/README.md @@ -211,10 +211,16 @@ const inputNode = getByLabelText(container, 'Username') // // // -// The aria-labelledby attribute +// The aria-labelledby attribute with form elements // // // +// The aria-labelledby attribute with other elements +//
+//

Section One

+//

some content...

+//
+// // Wrapper labels // // diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js index f0e0f6db..47d71609 100644 --- a/src/__tests__/element-queries.js +++ b/src/__tests__/element-queries.js @@ -82,7 +82,7 @@ test('matches case with RegExp matcher', () => { expect(queryByText(/Step 1 of 4/)).not.toBeTruthy() }) -test('get can get form controls by label text', () => { +test('can get form controls by label text', () => { const {getByLabelText} = render(`