* feat(service): add AppVeyor Job status badge
* refactor: sync file/class/route names for appveyor job
* tests: update # of build services in frontend test
Co-authored-by: Pierre-Yves B. <PyvesDev@gmail.com>
The two different kinds of data that can be passed to `<BadgeExample />` were a bit less similar than I thought, so this includes a little refactor related to that which isn't perfect, but leaves things in a cleaner place than before.
* Show patterns instead of real paths
* realBadge property instead of preview.buildFromExample
* E2e test for displaying a badge
* Check bagde url in badge wrapper
* expectBadgeExample helper function
* Remove a hostname from badge url
* Simpler Cypress assertions
* realBadge -> isBadgeSuggestion
* Do not show regexp in patterns
* Display suggested badges
* E2e test for badge suggestion
* Suggest resource returns example with pattern
* Do not require preview in MarkupModalContent
* Skip integration test for suggestion
* Unmodifiable path in customizer
* Use suggested link
* Allow to change suggested badges
* Enable skipped test
* Enable skipped test
* Code refactoring
* Code refactoring
* Code refactoring
* Code refactoring
* Code refactoring
* Code refactoring
* Unused code removed
* Unused code removed
* getExampleWithServiceByPattern helper added
* BadgeExamples uses examples instead of services definitions
* Revert "getExampleWithServiceByPattern helper added"
This reverts commit 80839fd705.
* style removed from example
* example.exact replaced with preview.buildFromExample
* keywords are required again
* Code refactoring
* More e2e tests for suggestion feature
* Code refactoring
* Build add with a base url
* showActualParams -> isPrefilled
* A new schema for BadgeExamples
* Link moved to queryParams
* Updated documentation for the suggest reponse format
* Link moved to queryParams - another test updated
* Revert "Link moved to queryParams - another test updated"
This reverts commit b5f811bb07.
* Revert "Link moved to queryParams"
This reverts commit 3b54c6d2b4.
* Disable changes in path in suggested badges
* 'link' element documentation restored
This will definitely save time, and ensure more uniformity.
It moves the `createServiceTester()` calls to a different place from where I'd like them, though I'm happy to have them checked by the linter.
Closes#2701
The frontend has a few tests in `lib/` but not all of that is covered. The components are not covered at all. It's difficult to make changes to the frontend because you have to manually test that things haven't broken.
This PR uses [Enzyme](https://airbnb.io/enzyme/) to add some [shallow-rendering tests](https://github.com/airbnb/enzyme/blob/master/docs/api/shallow.md), which are essentially unit tests of the components.
This should pave the way for functional tests of the more complex components.
- The goal of this PR is:
- Consume the new service-definition format. (#2397)
- Make the frontend more readable.
- Behavior changes:
- I changed the **Image** field in the markup modal to show only the path.
- I added another click-to-select field below that shows the complete URL.
- This made it easier to suppress the live badge preview while it contains placeholders like `:user` or `:gem`, a minor tweak discussed at https://github.com/badges/shields/issues/2427#issuecomment-442972100.
- The search box now searches all categories, regardless of the current page. (This is an improvement, I would say.)
- I did not deliberately address performance, though I ripped out a bunch of anonymous functions and avoided re-filtering all the examples by category on every render, which I expect will not hurt. I haven't really tested this on a mobile connection and it'd be worth doing that.
- It would be great to have some tests of the components, though getting started with that seemed like a big project and I did not want to make this any larger than it already is.
It's a medium-sized refactor:
1. Replace `BadgeExamples`, `Category` and `Badge` component with a completely rewritten `BadgeExamples` component which renders a table of badges, and `CategoryHeading` and `CategoryHeadings` components.
2. Refactor `ExamplesPage` and `SearchResults` components into a new `Main` component.
3. Rewrite the data flow for `MarkupModal`. Rather than rely on unmounting and remounting the component to copy the badge URL into state, employ the `getDerivedStateFromProps` lifecycle method.
4. Remove `prepareExamples` and `all-badge-examples`.
5. Rewrite the `$suggest` schema to harmonize with the service definition format. It's not backward-compatible which means at deploy time there probably will be 10–20 minutes of downtime on that feature, between the first server deploy and the final gh-pages deploy. 🤷♂️ (We could leave the old version in place if it seems worth it.)
6. Added two new functions in `make-badge-url` with tests. I removed _most_ of the uses of the old functions, but there are some in parts of the frontend I didn't touch like the static and dynamic badge generators, and again I didn't want to make this any larger than it already is.
7. Fix a couple bugs in the service-definition export.