Skip to content

Commit

Permalink
nette/tester 2.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 13, 2025
1 parent e779967 commit 86d9513
Show file tree
Hide file tree
Showing 16 changed files with 400 additions and 224 deletions.
39 changes: 25 additions & 14 deletions tester/bg/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@

DomQuery .[#toc-domquery]
-------------------------
`Tester\DomQuery` е клас, разширяващ `SimpleXMLElement` с методи за улесняване на тестването на HTML или XML съдържание.
`Tester\DomQuery` разширява `SimpleXMLElement` с лесни заявки за HTML или XML с помощта на селектори CSS.

```php
# в $html е низ с HTML документа, а в $dom получаваме кореновия елемент
$dom = Tester\DomQuery::fromHtml($html);

# we can test the presence of elements using CSS selectors
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# or select elements as array of DomQuery
$elems = $dom->find('input[data-autocomplete]');

# или проверете дали елементът отговаря на селектора (от версия 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/cs/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ Pomocné třídy

DomQuery
--------
`Tester\DomQuery` je třída rozšiřující `SimpleXMLElement` o metody usnadňující testování obsahu HTML nebo XML.
`Tester\DomQuery` je třída rozšiřující `SimpleXMLElement` o snadné vyhledávání v HTML nebo XML pomocí CSS selektorů.

```php
# v $html je řetězec s HTML dokumentem, v $dom získáme kořenový element
$dom = Tester\DomQuery::fromHtml($html);

# můžeme testovat přítomnost elementů podle CSS selektorů
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# nebo vybrat elementy jako pole DomQuery
$elems = $dom->find('input[data-autocomplete]');

# nebo ověřovat, zda element vyhovuje selektoru (od verze 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# vytvoření DomQuery z HTML řetězce
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test existence elementů pomocí CSS selektorů
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# nalezení elementů jako pole DomQuery objektů
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test, zda element odpovídá selektoru (od verze 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# nalezení nejbližšího předka odpovídajícího selektoru (od 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/de/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ Helfer

DomQuery
--------
`Tester\DomQuery` ist eine Klasse, die `SimpleXMLElement` mit Methoden erweitert, die das Testen von HTML- oder XML-Inhalten erleichtern.
`Tester\DomQuery` erweitert `SimpleXMLElement` um eine einfache HTML- oder XML-Abfrage mit CSS-Selektoren.

```php
# $html ist ein String mit dem HTML-Dokument, $dom ist das Root-Element.
$dom = Tester\DomQuery::fromHtml($html);

# we can test the presence of elements using CSS selectors
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# or select elements as array of DomQuery
$elems = $dom->find('input[data-autocomplete]');

# oder überprüfen, ob das Element mit dem Selektor übereinstimmt (ab Version 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/el/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@

DomQuery .[#toc-domquery]
-------------------------
`Tester\DomQuery` είναι μια κλάση που επεκτείνει το `SimpleXMLElement` με μεθόδους που διευκολύνουν τον έλεγχο περιεχομένου HTML ή XML.
`Tester\DomQuery` επεκτείνει το `SimpleXMLElement` με εύκολη αναζήτηση σε HTML ή XML χρησιμοποιώντας επιλογείς CSS.

```php
# στο $html είναι μια συμβολοσειρά με το έγγραφο HTML, στο $dom παίρνουμε το στοιχείο ρίζα
$dom = Tester\DomQuery::fromHtml($html);

# we can test the presence of elements using CSS selectors
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# or select elements as array of DomQuery
$elems = $dom->find('input[data-autocomplete]');

# ή να επαληθεύσει ότι το στοιχείο ταιριάζει με τον επιλογέα (από την έκδοση 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/en/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ Helpers

DomQuery
--------
`Tester\DomQuery` is a class that extends `SimpleXMLElement` with methods that make it easier to test HTML or XML content.
`Tester\DomQuery` extends `SimpleXMLElement` with easy HTML or XML querying using CSS selectors.

```php
# in $html is a string with the HTML document, in $dom we get the root element
$dom = Tester\DomQuery::fromHtml($html);

# we can test the presence of elements using CSS selectors
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# or select elements as array of DomQuery
$elems = $dom->find('input[data-autocomplete]');

# or verify that the element matches the selector (from version 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/es/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ Ayudantes

DomQuery
--------
`Tester\DomQuery` es una clase que amplía `SimpleXMLElement` con métodos que facilitan la comprobación de contenidos HTML o XML.
`Tester\DomQuery` amplía `SimpleXMLElement` con consultas HTML o XML sencillas mediante selectores CSS.

```php
# en $html es una cadena con el documento HTML, en $dom obtenemos el elemento raíz
$dom = Tester\DomQuery::fromHtml($html);

# podemos comprobar la presencia de elementos utilizando selectores CSS
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# o seleccionar elementos como array de DomQuery
$elems = $dom->find('input[data-autocomplete]');

# o verificar que el elemento coincide con el selector (a partir de la versión 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/fr/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ Aides

DomQuery
--------
`Tester\DomQuery` est une classe qui étend `SimpleXMLElement` avec des méthodes qui facilitent le test du contenu HTML ou XML.
`Tester\DomQuery` étend `SimpleXMLElement` en facilitant les requêtes HTML ou XML à l'aide de sélecteurs CSS.

```php
# dans $html est une chaîne avec le document HTML, dans $dom nous obtenons l'élément racine
$dom = Tester\DomQuery::fromHtml($html);

# we can test the presence of elements using CSS selectors
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# or select elements as array of DomQuery
$elems = $dom->find('input[data-autocomplete]');

# ou vérifier que l'élément correspond au sélecteur (à partir de la version 2.5.3)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
39 changes: 25 additions & 14 deletions tester/hu/helpers.texy
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ Segítők

DomQuery .[#toc-domquery]
-------------------------
`Tester\DomQuery` egy olyan osztály, amely a `SimpleXMLElement` címet bővíti olyan metódusokkal, amelyek megkönnyítik a HTML- vagy XML-tartalom tesztelését.
`Tester\DomQuery` kibővíti a `SimpleXMLElement` oldalt egyszerű HTML vagy XML lekérdezéssel CSS szelektorok segítségével.

```php
# a $html-ben egy karakterlánc a HTML dokumentummal, a $dom-ban pedig a gyökérelemet kapjuk meg.
$dom = Tester\DomQuery::fromHtml($html);

# we can test the presence of elements using CSS selectors
Assert::true($dom->has('form#registration'));
Assert::true($dom->has('input[name="username"]'));
Assert::true($dom->has('input[type="submit"]'));

# or select elements as array of DomQuery
$elems = $dom->find('input[data-autocomplete]');

# vagy ellenőrizze, hogy az elem megfelel-e a szelektornak (a 2.5.3. verziótól)
Assert::true($elems[0]->matches('[type="submit"]'));
# create DomQuery from HTML string
$dom = Tester\DomQuery::fromHtml('
<article class="post">
<h1>Title</h1>
<div class="content">Text</div>
</article>
');

# test element existence using CSS selectors
Assert::true($dom->has('article.post'));
Assert::true($dom->has('h1'));

# find elements as DomQuery array
$headings = $dom->find('h1');
Assert::same('Title', (string) $headings[0]);

# test if element matches selector (since version 2.5.3)
$content = $dom->find('.content')[0];
Assert::true($content->matches('div'));
Assert::false($content->matches('p'));

# find closest ancestor matching selector (since 2.5.5)
$article = $content->closest('.post');
Assert::true($article->matches('article'));
```


Expand Down
Loading

0 comments on commit 86d9513

Please sign in to comment.