This file contains hidden or 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 Login = ({isValid, isWaiting, error, onSignIn, onChange, username, password})=> { | |
function handleLogin(evt){ | |
evt.preventDefault(); //en el test ejecuta al spy! | |
onSignIn({username, password}); //llama al callback con los datos esperados | |
} | |
return <div className="login"> | |
<Row> | |
<Col s={12} m={6} l={4} className="offset-l4 offset-m3"> | |
<form className="login__form" onSubmit={handleLogin}> | |
</form> |
This file contains hidden or 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
describe('Form waiting', function () { | |
const props = { | |
isWaiting: true | |
}; | |
const wrapper = shallow(<Login {...props}/>); | |
it('should disable the input fields', ()=>{ | |
expect(wrapper.find('.login__user').prop('disabled')).toBe(true); | |
expect(wrapper.find('.login__password').prop('disabled')).toBe(true); | |
}); |
This file contains hidden or 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 Login = ({isValid, isWaiting, error, onSignIn, onChange, username, password})=> { | |
return <div className="login"> | |
<form className="login__form" onSubmit={handleLogin}> | |
<h4 className="login__title center-align">Bienvenido a Warehouse</h4> | |
<Input | |
className="login__user" | |
name="username" | |
value={username} | |
disabled={isWaiting} | |
/> |
This file contains hidden or 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
describe('Item', ()=>{ | |
function setup(){ | |
const data = { | |
name: 'test', | |
image: 'http://placeimg.com/400/300/people/grayscale', | |
available: true | |
}; | |
const anItem = Item.from(data); | |
return { data, anItem }; | |
} |
This file contains hidden or 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
require('./API'); | |
require('./Item'); | |
require('./Category'); | |
const App = { | |
selector: '#app', | |
fetchAPI: API, | |
run(){ | |
this.fetchAPI | |
.categories() |
This file contains hidden or 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
require('./API'); | |
require('./CategoryList'); | |
const App = { | |
selector: '#app', | |
fetchAPI: API, | |
run(){ | |
this.fetchAPI | |
.categories() | |
.then(this.addCategoriesToList.bind(this)) // cómo se puede preservar el this dentro de las promises? bluebird soporta un bind() pero parece que ES2015 no :( |
This file contains hidden or 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
require('./Container'); | |
require('./Renderizable'); | |
const Category = { | |
name: 'Category', | |
className: 'category', | |
tagName: 'article', | |
toHTML: Renderizable.toHTML, | |
This file contains hidden or 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
require('./API'); | |
require('./CategoryList'); | |
const App = { | |
selector: '#app', | |
fetchAPI: API, | |
run(){ | |
this.fetchAPI | |
.categories() | |
.then(this.wrapCategories) //si la función no necesita a this, no hago un bind innecesario |
This file contains hidden or 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
<?php | |
// Check for empty fields | |
if(empty($_POST['name']) || | |
empty($_POST['company']) || | |
empty($_POST['email']) || | |
empty($_POST['phone']) || | |
empty($_POST['country']) || | |
empty($_POST['message']) || | |
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) | |
{ |
This file contains hidden or 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
// Contact Form Scripts | |
$(function() { | |
$("#contactForm input,#contactForm textarea").jqBootstrapValidation({ | |
preventSubmit: true, | |
submitError: function($form, event, errors) { | |
// additional error messages or events | |
}, | |
submitSuccess: function($form, event) { |