Skip to content

Fix bug in screenshot DSL parsing - #78

Merged
chancancode merged 1 commit into
masterfrom
fix-screenshot-dsl
Oct 2, 2019
Merged

chancancode merged 1 commit into
masterfrom
fix-screenshot-dsl

Conversation

@chancancode

Copy link
Copy Markdown
Collaborator

I guess I was expecting String.prototype.split to work this way:

> "click .rentals li:first-of-type article.rental .image".split(/\s+/, 2);
[ 'click', 'rentals li:first-of-type article.rental .image' ]

But it does not, it returns this:

> "click .rentals li:first-of-type article.rental .image".split(/\s+/, 2);
[ 'click', '.rentals' ]

TL;DR I was expecting the limit parameter to mean that it will only split the first space, and the rest will be returned unspilt (like how it is in Ruby). However, it actually just split all the spaces anyway, the "extra" strings are just dropped from the returned array.

I guess I was expecting `String.prototype.split` to work this way:

```js
> "click .rentals li:first-of-type article.rental .image".split(/\s+/, 2);
[ 'click', 'rentals li:first-of-type article.rental .image' ]
```

But it does not, it returns this:

```js
> "click .rentals li:first-of-type article.rental .image".split(/\s+/, 2);
[ 'click', '.rentals' ]
```

TL;DR I was expecting the limit paramemter to mean that it will only
split the first space, and the rest will be returned unsplit (like how
it is in Ruby). However, it actually just split all the spaces anyway,
the "extra" strings are just dropped from the returned array.
@chancancode
chancancode merged commit 28ebcc3 into master Oct 2, 2019
@chancancode
chancancode deleted the fix-screenshot-dsl branch October 2, 2019 18:58
chancancode pushed a commit to ember-learn/guides-source that referenced this pull request Oct 2, 2019
* Merge ember-learn/super-rentals-tutorial#74

Remove alt text for decorative image

---

Commit:  ember-learn/super-rentals-tutorial@6062aa2
Script:  https://github.com/ember-learn/super-rentals-tutorial/blob/6062aa21fe7d3f2718d994d0d4d9f4d40158db09/scripts/deploy.sh
Logs:    https://travis-ci.org/ember-learn/super-rentals-tutorial/jobs/592222136

* Merge ember-learn/super-rentals-tutorial#73

Copy edit pass

---

Commit:  ember-learn/super-rentals-tutorial@f2fcd9d
Script:  https://github.com/ember-learn/super-rentals-tutorial/blob/f2fcd9d9cec3b71d5185ede26953292b24da2df5/scripts/deploy.sh
Logs:    https://travis-ci.org/ember-learn/super-rentals-tutorial/jobs/592251594

* Use backtick for `qunit-dom`

---

Commit:  ember-learn/super-rentals-tutorial@7502df1
Script:  https://github.com/ember-learn/super-rentals-tutorial/blob/7502df14b5267648f8442f590b709c1d9f10e181/scripts/deploy.sh
Logs:    https://travis-ci.org/ember-learn/super-rentals-tutorial/jobs/592593660

* Merge ember-learn/super-rentals-tutorial#77

Add summary images

---

Commit:  ember-learn/super-rentals-tutorial@4c1524e
Script:  https://github.com/ember-learn/super-rentals-tutorial/blob/4c1524ee26279bb87a31606573eadda2fd28c2b0/scripts/deploy.sh
Logs:    https://travis-ci.org/ember-learn/super-rentals-tutorial/jobs/592686563

* Merge ember-learn/super-rentals-tutorial#78

Fix bug in screenshot DSL parsing

---

Commit:  ember-learn/super-rentals-tutorial@28ebcc3
Script:  https://github.com/ember-learn/super-rentals-tutorial/blob/28ebcc38de56c77d50fcf0c3bab011dc0deb575a/scripts/deploy.sh
Logs:    https://travis-ci.org/ember-learn/super-rentals-tutorial/jobs/592719662

* Merge ember-learn/super-rentals-tutorial#79

Use regex correctly (-‸ლ)

---

Commit:  ember-learn/super-rentals-tutorial@c76a874
Script:  https://github.com/ember-learn/super-rentals-tutorial/blob/c76a8744e1f2fa72e261009b7ecc3757cb45f7c5/scripts/deploy.sh
Logs:    https://travis-ci.org/ember-learn/super-rentals-tutorial/jobs/592774277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant