Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agregue el readme con imágenes #6

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
463ca78
Agregue el readme con imagenes
Paola-To Jun 28, 2019
9a1119c
Merge pull request #1 from Paola-To/rama-Paola
Paola-To Jun 28, 2019
228ee60
Corregi la extensión de las imagenes del readme
Paola-To Jun 28, 2019
ffbd3f3
Merge pull request #2 from Paola-To/rama-Paola
Paola-To Jun 28, 2019
d7a8aae
Se agrego footer y botón de GO en el index
Paola-To Jun 28, 2019
bffcc61
Agrego meta para hacer el html responsive y se descomenta la linea de…
rebe-san Jun 30, 2019
a4eae14
Agregue la parte de CSS y los distintos html en la maqueta
Paola-To Jul 2, 2019
d8a9bca
Merge pull request #3 from Paola-To/rama-Paola
Paola-To Jul 2, 2019
7c8ccdf
Subo funcion que recorre la data y muestra el nombre y la imgen en html
rebe-san Jul 2, 2019
d9d3c96
Merge branch 'rama-Paola' into rama-Rebeca
rebe-san Jul 2, 2019
828d70a
Subo main.js con la funcion que recorre la data y que muestra en el b…
rebe-san Jul 2, 2019
39d952f
Merge branch 'rama-Rebeca' of https://github.com/rebe-san/MEX-Data-Lo…
rebe-san Jul 2, 2019
81facfb
Merge pull request #5 from rebe-san/rama-Rebeca
Paola-To Jul 2, 2019
125f99c
Creo archivo app.js ,app.html y app.css , que contiene la data desple…
rebe-san Jul 3, 2019
0452065
Merge pull request #6 from rebe-san/rama-Rebeca
Paola-To Jul 3, 2019
a3ed261
Agregue css en welcome.html
Paola-To Jul 3, 2019
7a1c185
Merge branch 'master' into rama-Paola
Paola-To Jul 3, 2019
a64dbcf
Merge pull request #7 from Paola-To/rama-Paola
Paola-To Jul 3, 2019
d284f95
Actualización de welcome.html
Paola-To Jul 3, 2019
a8b9cf5
Merge branch 'rama-Paola' of https://github.com/Paola-To/MEX-Data-Lov…
Paola-To Jul 3, 2019
03cf36e
Merge branch 'master' into rama-Paola
Paola-To Jul 3, 2019
757315b
Agregue estilo a appi.html
Paola-To Jul 4, 2019
62700e5
Merge pull request #8 from Paola-To/rama-Paola
Paola-To Jul 4, 2019
a83591c
SE agrego estilo al index
Paola-To Jul 4, 2019
8c6b070
Merge pull request #9 from Paola-To/rama-Paola
Paola-To Jul 4, 2019
6badcfd
Subo archivo data.js con la funcion filtrar por nombre
rebe-san Jul 5, 2019
a35ae01
Merge branch 'master' of https://github.com/Paola-To/MEX-Data-Lovers-008
rebe-san Jul 5, 2019
07dea7b
Se agrego select a la welcome.html
Paola-To Jul 5, 2019
7728b70
Merge pull request #10 from Paola-To/rama-Paola
Paola-To Jul 5, 2019
c9fc063
Subo data.js con las funciones de ordenar ascendentemente y descenden…
rebe-san Jul 5, 2019
94c37bd
Merge branch 'master' of https://github.com/Paola-To/MEX-Data-Lovers-008
rebe-san Jul 5, 2019
471e396
Merge branch 'master' into rama-Rebeca
rebe-san Jul 5, 2019
6a77e77
Merge pull request #11 from rebe-san/rama-Rebeca
Paola-To Jul 5, 2019
73df436
Se agrego CSS a index,welcome.
Paola-To Jul 5, 2019
bc3595e
Merge branch 'master' of https://github.com/Paola-To/MEX-Data-Lovers-008
rebe-san Jul 5, 2019
69d6102
Merge branch 'master' into rama-Rebeca
rebe-san Jul 5, 2019
a33e486
Se soluciono el conflicto de index.html
Paola-To Jul 5, 2019
3cccc05
Se agrego favicon
Paola-To Jul 5, 2019
034c442
Merge pull request #12 from Paola-To/rama-Paola
Paola-To Jul 5, 2019
96f85fb
Subo appi.html con el input para filtrar por nombre y appi.js con la …
rebe-san Jul 5, 2019
c424d39
Merge pull request #13 from rebe-san/rama-Rebeca
Paola-To Jul 5, 2019
8505ea6
Merge pull request #14 from rebe-san/rama-Rebeca
Paola-To Jul 5, 2019
7efb24c
Se sue archivo con las funciones de filtrar por nombre , ordenar asce…
rebe-san Jul 8, 2019
d9f2e84
Merge branch 'rama-Paola' into rama-Rebeca
Paola-To Jul 8, 2019
c31209b
Merge pull request #15 from rebe-san/rama-Rebeca
Paola-To Jul 8, 2019
7cb6ae2
Merge branch 'master' into rama-Paola
Paola-To Jul 8, 2019
4d42332
Merge pull request #16 from Paola-To/rama-Paola
Paola-To Jul 8, 2019
b9fdfa2
Agregue iconos redimensionados, y css responsive en header
Paola-To Jul 9, 2019
dd06fd8
Merge pull request #17 from Paola-To/rama-Paola
Paola-To Jul 9, 2019
41eec75
Subo funciones reordenadas y la funcion que calcula la altura promedi…
rebe-san Jul 9, 2019
2de2ec0
Merge branch 'rama-Rebeca' of https://github.com/rebe-san/MEX-Data-Lo…
rebe-san Jul 9, 2019
327d92b
Merge branch 'master' into rama-Rebeca
Paola-To Jul 9, 2019
c5c5901
Merge pull request #18 from rebe-san/rama-Rebeca
Paola-To Jul 9, 2019
ff1a7f3
Subo archivo style.css comentado y modificado para hacer el diseño re…
rebe-san Jul 13, 2019
2a39aa1
Merge pull request #19 from rebe-san/rama-Rebeca
Paola-To Jul 14, 2019
3e6e4b2
Actualización funciones
Paola-To Jul 14, 2019
63bfa1f
Merge branch 'master' into rama-Paola
Paola-To Jul 14, 2019
05ec86d
Merge pull request #20 from Paola-To/rama-Paola
Paola-To Jul 14, 2019
8e2df6c
Subo archivo data.spec.js con los test para las funciones de filtrado…
rebe-san Jul 15, 2019
f6b603f
Merge branch 'rama-Paola' into rama-Rebeca
Paola-To Jul 15, 2019
2371a42
Merge pull request #21 from rebe-san/rama-Rebeca
Paola-To Jul 15, 2019
97250dc
Merge pull request #22 from Paola-To/rama-Paola
Paola-To Jul 15, 2019
981da2d
Subo archivos quitando comentarios y ordenando el codigo
rebe-san Jul 15, 2019
5b88958
Merge pull request #23 from rebe-san/rama-Rebeca
Paola-To Jul 15, 2019
24e0c8f
Actualización del Readme
Paola-To Jul 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@
},
"extends": "eslint:recommended",
"globals": {
"POKEMON": false,
"example": false
"POKEMON": false,
"functions": false
},
"rules": {
"no-console": 0,
"semi": 2,
"semi": 2
}
}
35 changes: 15 additions & 20 deletions src/data.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//Declaracion de Variables
let arrayPokemon = POKEMON.pokemon;//Arreglo de objetos pokemon

//Funcion de filtrado po nombre
const filterName=(string)=>{ // Guarda en filterByName el objeto que cumple con la condicion.
let filterByName=arrayPokemon.filter((objPokemon)=> {return objPokemon.name === string;});
window.functions={
filterName:(string,array)=>{ // Guarda en filterByName el objeto que cumple con la condicion.
let filterByName=array.filter((objPokemon)=> {return objPokemon.name === string;});
return filterByName;
};
},
//Filtrado por tipo
const filterType=()=>{// Falta pasar el tipo para quee ejecute la funcion.
let filterType = arrayPokemon.filter(
@@ -19,8 +20,8 @@ const filterType=()=>{// Falta pasar el tipo para quee ejecute la funcion.
return filterType;
} */
//Funcion de ordenamiento por nombre de forma ascendente
const orderedAscArray =()=>{
let orderedArrayAsc=arrayPokemon.sort(function (a, b) {
orderedAscArray:(array)=>{
let orderedArrayAsc=array.sort(function (a, b) {
if (a.name > b.name) {
return 1;
}
@@ -30,10 +31,10 @@ let orderedArrayAsc=arrayPokemon.sort(function (a, b) {
return 0;
});
return orderedArrayAsc;
};
},
//Funcion de ordenamiento por nombre de forma ascendente
const orderedDescArray =()=>{
let orderedArrayDesc=arrayPokemon.sort(function (a, b) {
orderedDescArray:(array)=>{
let orderedArrayDesc=array.sort(function (a, b) {
if (a.name > b.name) {
return -1;
}
@@ -43,24 +44,18 @@ let orderedArrayDesc=arrayPokemon.sort(function (a, b) {
return 0;
});
return orderedArrayDesc;
};
//Calcula el promedio de altura de los pokemones
const computeStats = ()=>{
},
/* computeStats : (array)=>{
let averageHeight= 0;
arrayPokemon.forEach((objPokemon) => {
array.forEach((objPokemon) => {
console.log(objPokemon.height);
console.log(objPokemon.height.slice(0,4));
console.log(parseFloat(objPokemon.height.slice(0,4)));
console.log("Pokemones "+arrayPokemon.length);
averageHeight=parseFloat(objPokemon.height.slice(0,4))+averageHeight;});
console.log("Promedio "+averageHeight/arrayPokemon.length);
}, */
};
//Declaracion de variables globales

/* window.filterType=filterType;*/
window.computeStats=computeStats;
window.arrayPokemon=arrayPokemon;
window.filterName=filterName;
window.orderedAscArray=orderedAscArray;
puteStats=computeStats;
window.orderedDescArray=orderedDescArray;
//Calcula el promedio de altura de los pokemones
29 changes: 21 additions & 8 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -3,9 +3,12 @@ const orderAsc=document.getElementById("order-az"); //Elemento A-Z del menu desp
const orderDesc=document.getElementById("order-za"); //Elemento Z-A del menu desplegable
const divResults=document.getElementById("results-container");//Contenedor donde se muestra toda la data
const iconoSearch=document.getElementById("icono-search");//Icono de busqueda
const logoHeader=document.getElementById("logo-header");
const arrayPokemon=POKEMON.pokemon;
/* const typesList= document.getElementById("types-list"); *///Menu de tipos
//Funcion que crea los nodos en el div results-container
const createNodes = (objPokemon) => {
const createNodes = (array) => {
array.forEach((objPokemon) => {
//Crea un div por cada pokemon
let elementDiv= document.createElement("div");//Crea un nodo div
elementDiv.setAttribute("class","obj-pokemon"); //Agrega una clase(objPokemon) al elemento (elementDIv)
@@ -29,6 +32,8 @@ const createNodes = (objPokemon) => {
let contentWeak=document.createTextNode("Debilidades: "+objPokemon.weaknesses);//Crea un nodo de texto
elementWeak.appendChild(contentWeak);// Adjunta el hijo(contentWeak) al padre(elementWeak)
elementDiv.appendChild(elementWeak);//Adjunta el hijo(elementName) al padre(elemntDiv)
});

};
//Funcion que borra los nodos en el div results-container
const deleteNodes= () => {
@@ -37,26 +42,33 @@ const deleteNodes= () => {
}
};
//Funcion que muestra toda la data.
const showData = () => {
arrayPokemon.forEach((objPokemon) => {createNodes(objPokemon);});
const showData = () => {
deleteNodes();
arrayPokemon.sort(function (a, b) {
return (a.id - b.id);
});
createNodes(arrayPokemon);
};
//Funcion que muestra la data ordenada de forma ascendente por nombre
const ArrayAsc = () => {
deleteNodes();
let array=orderedAscArray();
array.forEach(orderData = (objPokemon) => {createNodes(objPokemon);});
let array=window.functions.orderedAscArray(arrayPokemon);
/* array.forEach((objPokemon) => {createNodes(objPokemon);}); */
createNodes(array);
};
//Funcion que muestra la data ordenada de forma descendente por nombre
const ArrayDesc = () => {
deleteNodes();
orderedDescArray().forEach((objPokemon) => {createNodes(objPokemon);});
let array=window.functions.orderedDescArray(arrayPokemon);
createNodes(array);
};
//Funcion que filtra la data por nombre.
const filterDataByName = () => {
deleteNodes();
let inputName= document.getElementById("input-name").value;
let inputNameConverted = inputName[0].toUpperCase() +inputName.slice(1).toLowerCase();
filterName(inputNameConverted).forEach((objPokemon) => { createNodes(objPokemon);});
let array= window.functions.filterName(inputNameConverted,arrayPokemon);
createNodes(array);
};
//Funcion que muestra la data ordenada de forma ascendente por nombre
/* const filterDataByType = (type) => {
@@ -66,7 +78,8 @@ const filterDataByName = () => {
orderAsc.addEventListener('click',ArrayAsc);
orderDesc.addEventListener('click',ArrayDesc);
iconoSearch.addEventListener('click',filterDataByName);
logoHeader.addEventListener('click',showData);
/* typesList.addEventListener('click', (e) => {(filterDataByType(e.target.dataset.type)
{console.log(e.target.dataset.type) */
showData();
computeStats();
/* computeStats(); */
82 changes: 64 additions & 18 deletions test/data.spec.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,71 @@
require('../src/data.js');
require('../src/data.js');
/* require('../src/data/pokemon/pokemon.js'); */
const array= [{
"name": "Bulbasaur"
}, {
"name": "Ivysaur"
}, {
"name": "Venusaur"
}, {
"name": "Charmander"
}, {
"name": "Charmeleon"
}
];

/* describe('filterName', () => {
it('is a function', () => {
expect(typeof filterName).toBe('function');
const arrayOrderAz= [{
"name": "Bulbasaur"
}, {
"name": "Charmander"
}, {
"name": "Charmeleon"
}, {
"name": "Ivysaur"
}, {
"name": "Venusaur"
}
];

const arrayOrderZa= [{
"name": "Venusaur"

}, {
"name": "Ivysaur"

}, {
"name": "Charmeleon"
}, {
"name": "Charmander"
}, {
"name": "Bulbasaur"
}
];
describe('dataFunctions', () => {
it('functions es un objeto', () => {//Test para comprobar que dataFunctions es un objeto
expect(typeof(functions)).toBe('object');
});

it('filterName es un funcion', () => { //Test para comprobar que filtername es una funcion
expect(typeof(functions.filterName)).toBe('function');
});

it('returns `filterName`', () => {
expect(filterName()).toBe('filterName');
it('filterName es correcta', () => { //Test para comprobar que filtername es una funcion
expect(functions.filterName('Charmeleon',array)).toEqual([array[4]]);
});
});
*/
/* const rick={
"id": 1, "name":"Rick "
}

describe('filterName', () => {
it('is a function', () => {
expect(typeof filterName).toBe('function');

it('orderedAscArray es una funcion', () => { //Test para comprobar que filtername es una funcion
expect(typeof(functions.orderedAscArray)).toBe('function');
});

it('orderedAscArray es correcta', () => { //Test para comprobar que filtername es una funcion
expect(functions.orderedAscArray(array)).toEqual(arrayOrderAz);
});

it('Deberia retornar un arreglo de objetos', () => {
expect(filterData(data,"Rick")).toEqual([rick]);
it('orderedDescArray es una funcion', () => { //Test para comprobar que filtername es una funcion
expect(typeof(functions.orderedDescArray)).toBe('function');
});

it('orderedADescArray es correcta', () => { //Test para comprobar que filtername es una funcion
expect(functions.orderedDescArray(array)).toEqual(arrayOrderZa);
});
}); */
});