This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Xanthan is a cute declarative way to compose different sets of traits onto Sequelize models | |
* | |
* It is distributed under the terms of the WTFPL (http://www.wtfpl.net/about/) | |
* | |
* Usage: | |
* const {Sequelize, DataTypes: { TEXT, INTEGER } } = require('sequelize'); | |
* const { getFoo, setFoo } = require('./expandos/foo'); | |
* require('./xanthan')(Sequelize)({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cache = {}; | |
export default class URI | |
{ | |
constructor(url){ | |
this.url = url | |
this.parts = {} | |
} | |
parse(){ | |
if(this.url in cache){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PASS test/list-all-albums.steps.js | |
✓ Viewing the Gallery (177ms) | |
Test Suites: 1 passed, 1 total | |
Tests: 1 passed, 1 total | |
Snapshots: 0 total | |
Time: 0.732s, estimated 1s | |
Ran all test suites. | |
Watch Usage: Press w to show more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Album = ({photos}) => <Fragment> | |
{photos.map(photo => <Thumbnail photo={photo} key={photo.id}/>)} | |
</Fragment>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Gallery = ({data}) => <Fragment> | |
{Object.keys(data).map(id => <Album | |
photos={data[id].photos} | |
key={id}) | |
/> | |
}</Fragment>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imports omitidos por brevedad | |
const feature = loadFeature('./test/features/list-all-albums.feature'); | |
defineFeature(feature, test => { | |
test('Viewing the Gallery', ({given, when, then}) => { | |
let testInstance; | |
let gallery; | |
given('the Gallery component is present', () => { | |
const renderer = TestRenderer.create( <Gallery data={MockData}/> ); | |
Gallery = renderer.root; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// components/Gallery/Gallery.js | |
Import React, {Component, Fragment} from 'react'; | |
export default Gallery = () => <Fragment>Galería</Fragment>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// view-a-photo.feature | |
Feature: View a photo in full size | |
In order to view an album's photo | |
As an user | |
I want to open the first Album and see its contents, then open its first Photo | |
Scenario: Viewing a single Photo | |
Given the Gallery component is present | |
And the first album was selected | |
When the Photos are visible | |
Then I want to open a Photo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//view-an-album.feature | |
Feature: View an album's contents | |
In order to view an album's contents | |
As an user | |
I want to open the first Album and see its contents, then the second one, and have the first one close before | |
Scenario: Viewing an album's photos | |
Given the Gallery component is present | |
And the first album was selected | |
When album opens | |
Then I want the Album to keep a list of Photos in it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// list-all-albums.feature | |
Feature: List all of the site's albumsIn order to check how many albums my site currently has | |
As an user | |
I want there to be a Gallery | |
Scenario: Listing all albums | |
Given the Gallery component is present | |
When the page is rendered | |
Then I want the component to have an Album for each gallery in the site | |
And I want the Album to hold a Thumbnail for each image in it |
NewerOlder