Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
148 changes: 82 additions & 66 deletions README.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const getFilmsByTitle = {
};

export const getFilmsInOrder = (order) => {
console.log(order);
const orderedFilms = ghibli.films.slice();
orderedFilms.sort((a,b) => {
const titleA = a.title.toUpperCase();
Expand Down
Binary file added src/img/baja_fidelidad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/figma_escritorio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/img_papelylapiz.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/portada.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/prototipo_movil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<link rel="shortcut icon" href="./img/Totoro1.ico" type="image/x-icon">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100&family=Roboto:wght@100&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100&family=Roboto:wght@100&display=swap" rel="stylesheet">
<title>Ghibli Dreams (Data Lovers)</title>
</head>

Expand Down
5 changes: 2 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getFilmsData, getFilmsByProducer, getFilmsByTitle, getFilmsInOrder,computeStats } from './data.js';
import { getFilmsData, getFilmsByProducer, getFilmsByTitle, getFilmsInOrder, computeStats } from './data.js';
// declaración de variable que muestra el array de películas al cargar en DOM
const filmsData = getFilmsData();
loadInitialData()
loadInitialData();

const selectProducer = document.getElementById('selectProducer');
selectProducer.addEventListener('change', (event) => {
Expand Down Expand Up @@ -66,7 +66,6 @@ function displayFilms(films) {
const selectOrder = document.getElementById('selectOrder');
selectOrder.addEventListener('change', (event) => {
const orderedTitles = event.target.value;
console.log(orderedTitles);
const orderedFilms = getFilmsInOrder(orderedTitles);
document.getElementById("root").textContent = "";

Expand Down
6 changes: 5 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ body {
background-color: #eee;
font-family: 'Outfit', sans-serif;
font-family: 'Roboto', sans-serif;
margin-bottom: 50px;
padding-bottom: 10px;
}
/*header*/
.banner{
Expand Down Expand Up @@ -152,7 +154,9 @@ footer {
display: flex;
justify-content: center;
flex-wrap: wrap;
letter-spacing: 5px;
margin-top: 3px;
margin-bottom: 3px;
text-align: center;
color: rgb(245, 241, 241);
}
@media (max-width:750px) {
Expand Down
76 changes: 66 additions & 10 deletions test/data.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getFilmsByTitle,computeStats } from '../src/data.js';
import { getFilmsByTitle, computeStats, getFilmsData, getFilmsByProducer, getFilmsInOrder } from '../src/data.js';

const data = [
{
Expand Down Expand Up @@ -66,15 +66,15 @@ const data = [
},
];

describe('getFilmsByTitle', ()=> {
describe('getFilmsByTitle', () => {

it('debería ser un objeto', () => {
expect(typeof getFilmsByTitle).toBe('object');
});

describe('byNameFilms', ()=> {
describe('byNameFilms', () => {

it ('deberia ser function', ()=>{
it('deberia ser function', () => {
expect(typeof getFilmsByTitle.byNameFilms).toBe('function');
})

Expand Down Expand Up @@ -130,14 +130,11 @@ describe('getFilmsByTitle', ()=> {
];
expect(getFilmsByTitle.byNameFilms(data, "My")).toStrictEqual(expectedResult);
});

});

});


describe('computeStats', ()=> {
it('debería ser un function', () => {
describe('computeStats', () => {
it('debería ser una function', () => {
expect(typeof computeStats).toBe('function');
});

Expand All @@ -150,11 +147,70 @@ describe('computeStats', ()=> {
ratingAbove89: '67%',
ratingBelow90: '33%',
}

expect(computeStats(data)).toEqual(expectedResult);
});
});

describe('Test para la funcion getFilmsData', () => {
it('Es una funcion que trae los valores especificados', () => {
expect(typeof getFilmsData).toBe('function');
});

it('la funcion getFilmsData Debe devolver un arreglo de objetos con datos de películas', () => {
const filmsData = {
"title": "Castle in the Sky",
"description": "The orphan Sheeta inherited a mysterious crystal that links her to the mythical sky-kingdom of Laputa. With the help of resourceful Pazu and a rollicking band of sky pirates, she makes her way to the ruins of the once-great civilization. Sheeta and Pazu must outwit the evil Muska, who plans to use Laputa's science to make himself ruler of the world.",
"director": "Hayao Miyazaki",
"producer": "Isao Takahata",
"poster": "https://static.wikia.nocookie.net/studio-ghibli/images/c/c1/Castle_in_the_Sky.jpg",
"release_date": "1986"
};
expect(getFilmsData()).toEqual(expect.arrayContaining([expect.objectContaining(filmsData)]));
});
});

describe('getFilmsByProducer', () => {
it('Es una funcion para filtrar por productores', () => {
expect(typeof getFilmsByProducer).toBe('function');
});

it('La funcion getFilmsByProducer solo debe retornar las peliculas del productor elegido', () => {
const filmsData = {
"title": "Castle in the Sky",
"description": "The orphan Sheeta inherited a mysterious crystal that links her to the mythical sky-kingdom of Laputa. With the help of resourceful Pazu and a rollicking band of sky pirates, she makes her way to the ruins of the once-great civilization. Sheeta and Pazu must outwit the evil Muska, who plans to use Laputa's science to make himself ruler of the world.",
"director": "Hayao Miyazaki",
"producer": "Isao Takahata",
"poster": "https://static.wikia.nocookie.net/studio-ghibli/images/c/c1/Castle_in_the_Sky.jpg",
"release_date": "1986"
};
expect(getFilmsByProducer("Isao Takahata")).toContainEqual(filmsData);
});
it('La funcion getFilmsByProducer devuelve un array con las peliculas del productor escogido', () => {
//expect(typeof getFilmsByProducer("Isao Takahata")).toEqual('Array');
expect(typeof getFilmsByProducer("Isao Takahata")).toEqual('object');
});
});

describe('getFilmsInOrder', () => {
it('Es una funcion para ordenar alfabeticamente las peliculas', () => {
expect(typeof getFilmsInOrder).toBe('function');
});

it('La funcion getFilmsInOrder debe ordenar las peliculas de la A-Z', () => {
const orderedFilms = getFilmsInOrder("A-Z");
const titleFirstFilm = orderedFilms[0].title;
const titleLastFilm = orderedFilms[orderedFilms.length - 1].title;
expect(titleFirstFilm).toBe("Castle in the Sky");
expect(titleLastFilm).toBe("Whisper of the Heart");
});
it('La funcion getFilmsInOrder debe ordenar las peliculas de la Z-A', () => {
const orderedFilms = getFilmsInOrder("Z-A");
const titleFirstFilm = orderedFilms[0].title;
const titleLastFilm = orderedFilms[orderedFilms.length - 1].title;
expect(titleFirstFilm).toBe("Whisper of the Heart");
expect(titleLastFilm).toBe("Castle in the Sky");
});
});



Expand Down