Jest, RTL, jest-dom. Find link by href regardless it content - jestjs

I have a text container with a few links.
I want to test link presence with particular href, no matter what text within.
How can I do it?
<div class="styles_info__5-SjJ">
Lorem ipsum dolor sit amet
</div>
I've tried
expect(screen.getByRole("link")).toHaveAttribute("href","https://my.link");
Got error:
TestingLibraryElementError: Found multiple elements with the role "link"
Tried
expect(screen.getAllByRole("link")).toHaveAttribute("href","https://my.link");
Got error:
received value must be an HTMLElement or an SVGElement.
Received has type: array

Related

Flask Ckeditor receives the returned value and is rendered by ‘Render_template’

I am learning CKEditor in python flask.
It’s no problem to submit documents with this.
The content contains the code that needs to be rendered by flask render_template, such as {{ *** }}, but if I need to edit again, pass {{ ckeditor.create (value=content) }} After receiving the text marked with {{ *** }}, it will be rendered by render_template. I don’t want to be rendered by render_template.
I want the returned data to be displayed in the edit box of CKEditor:
not:
I tried :
<form method="POST">
{{ ckeditor.create(value=content|safe) }}
<input type="submit" name="submit">
</from>
but it doesn't seem to work!
I want to know how to solve this problem, or what caused it?
If you can't see the picture, you can click here
Although no one can answer my question, I found the answer in another version of the official document, so I still share it !
The key to solving the problem is to do some data processing before flask renders the template!
return render_template('xxxx.html', content = content.replace( '&', '&'))

Validating text after <br> in Atata

I have this table cell on my page:
<td>
<strong>Some Text</strong>
<br>random description
</td>
I'd like to come up with a way to validate the text after the br and have it return that as Text<T> so I can use the atata asserts (like Should.Equal("random description")) - separately from the text inside the <strong> but so far have been unable to do anything more than get that text as a string by getting the td via xpath and .Split("\r\n") it's Value - is there a way to get just this text?
You can do that by adding [ContentSource(ContentSource.LastChildTextNode)] attribute to your text control.
Alternatively, you can invoke TextControl.GetContent(ContentSource.LastChildTextNode) method.

Do web-crawlers find content inside SVG?

SVG support of current browsers is good.
Even foreignObject is supported.
See related answer: https://stackoverflow.com/a/58802113/633961
This way you can insert HTML into SVG and create artistic valueable web pages.
BUT: Do web-crawlers (mainly google's spider) find and index my content which is on the page via a foreignObject (HTML) inside SVG. With the SVG being on a HTML page?
With other words: Would google index "Lorem ipsum dolor..." in above Stackoverflow answer?

Twig template section with variable

Im writing little CMS, for this project Im using Laravel/Lumen FW and Twig engine for templates.
I would like to had option to dynamically edit front page, and her sections. Sections of my front page, are stored in mySQL base as text where I putting my html code of section. Section is printed by Twig, by for statement.
Everything work's fine until, I put another variable into my section content in mySQL base.
I does it becouse I want to made child element for my section, which could be displayed only into her area.
Twig for loop:
{% for section in sections %}
{{ section.content }}
{% endfor %}
Value of section.content in mySQL base:
Lorem ipsum {{ section.name }}
Result which I saw is plain text, without rendering by twig, so it looks like content in base.
Lorem ipsum {{ section.name }}
What could I do to print variable inside other variable in Twig engine?
Thanks.

Replace cufon text inline with browser

My goal is simple : I have a page with cufon titles.
And I have a bookmarklet script to change all text on a page in lorem ipsum automatically.
But cufon text is not transformed.
Can I change cufon text with developer tool in chrome browser or other ?
I have tried with console to run a command like :
Cufon.reload();
or
Cufon.refresh();
But that doesn't work.
Someone can help me ?
I have found the solution :
First : replace alt attribute of the cufon tag.
<cufon class="cufon cufon-canvas" alt="Home"
to :
<cufon class="cufon cufon-canvas" alt="Lorem"
Second execute in console :
Cufon.replace('.menu-item a');
in my case. (to be applicate for each element to replace)

Resources