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
let fileInputField = document.querySelector('#file-upload-field'); | |
let uploadEvent = new Event('change'); | |
let fileBlob = { files: [new Blob(['Hello World...'])] }; | |
fileInputField.value = fileBlob.files; | |
fileInputField.dispatchEvent('change'); |
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
targetElement.dispatchEvent(event, additionalEventArguments); |
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
let myButton = document.querySelector('button'); | |
// emulates a 'click' event dispatched from the selected button element | |
myButton.click(); |
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
import '@testing-library/jest-dom'; | |
import * as React from 'react'; | |
import Upload from '../src/Upload'; | |
import {render, fireEvent, waitFor, screen} from '@testing-library/react'; | |
test('allows uploading files', async () => { | |
render(<Upload | |
title="Update Mokedexx" | |
description="Add your new companions here 🇰🇷" | |
label="업로드 한국 모켓몬" |
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
// Ember & QUnit | |
// file-upload/tests/integration/components/upload-test.js | |
import { module, test } from 'qunit'; | |
import { setupRenderingTest } from 'ember-qunit'; | |
import { click, find, render, triggerEvent } from '@ember/test-helpers'; | |
import { hbs } from 'ember-cli-htmlbars'; | |
module('Integration | Component | mox/upload', function (hooks) { | |
setupRenderingTest(hooks); |
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
// React | |
// file-upload/common/Upload.js | |
import React from 'react'; | |
class UploadComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {fileContent: ''}; | |
this.handleFileInput = this.handleFileInput.bind(this); |
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
// file-upload/app/components/upload.js | |
import Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
import { action } from '@ember/object'; | |
import { next } from '@ember/runloop'; | |
export default class UploadComponent extends Component { | |
@tracked | |
fileContent = ''; |
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
**Ember** | |
==2.17== | |
- [BUGFIX beta] Avoid double throwing unhandled promise rejections. | |
Improved Debugging of Rejected Promises. | |
https://github.com/emberjs/ember.js/commit/21298e967414741d0c3d86eb2f07fad5d2feb2ed | |
- [BUGFIX beta] Ensure helpers have a consistent API. | |
Unification of return values of class-based and simple helpers for better testing ergonomics. |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
}); |
NewerOlder