<commit_before>/*
 * #%L
 * GwtMaterial
 * %%
 * Copyright (C) 2015 - 2016 GwtMaterialDesign
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package gwt.material.design.addins.client;

import gwt.material.design.addins.client.base.MaterialAddinsTest;
import gwt.material.design.addins.client.dnd.MaterialDnd;
import gwt.material.design.addins.client.dnd.constants.Restriction;
import gwt.material.design.addins.client.dnd.js.JsDragOptions;
import gwt.material.design.client.constants.Axis;
import gwt.material.design.client.events.*;
import gwt.material.design.client.ui.MaterialIcon;
import gwt.material.design.client.ui.MaterialPanel;

import static gwt.material.design.jquery.client.api.JQuery.$;

public class MaterialDndTest extends MaterialAddinsTest {

    public void init() {
        checkDragEvents();
        checkDropEvents();
        checkRestriction();
        checkInertia();
        checkAxis();
    }

    protected void checkAxis() {
        final String VERTICAL_AXIS = "y";
        final String HORIZONTAL_AXIS = "x";
        MaterialPanel panel = new MaterialPanel();
        MaterialDnd dnd = MaterialDnd.draggable(panel, JsDragOptions.create(Axis.VERTICAL));
        assertEquals(dnd.getDragOptions().axis, VERTICAL_AXIS);
        dnd.getDragOptions().axis = HORIZONTAL_AXIS;
        assertEquals(dnd.getDragOptions().axis, HORIZONTAL_AXIS);
    }

    protected void checkInertia() {
        MaterialPanel panel = new MaterialPanel();
        MaterialDnd dnd = MaterialDnd.draggable(panel, JsDragOptions.create(true));
        assertTrue(dnd.getDragOptions().inertia);
        dnd.getDragOptions().inertia = false;
        assertFalse(dnd.getDragOptions().inertia);
    }
<commit_msg>Dnd Test - Follow up test on Check Dropzone api<commit_after>/*
 * #%L
 * GwtMaterial
 * %%
 * Copyright (C) 2015 - 2016 GwtMaterialDesign
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package gwt.material.design.addins.client;

import gwt.material.design.addins.client.base.MaterialAddinsTest;
import gwt.material.design.addins.client.dnd.MaterialDnd;
import gwt.material.design.addins.client.dnd.constants.Restriction;
import gwt.material.design.addins.client.dnd.js.JsDragOptions;
import gwt.material.design.addins.client.dnd.js.JsDropOptions;
import gwt.material.design.client.constants.Axis;
import gwt.material.design.client.events.*;
import gwt.material.design.client.ui.MaterialIcon;
import gwt.material.design.client.ui.MaterialPanel;

import static gwt.material.design.jquery.client.api.JQuery.$;

public class MaterialDndTest extends MaterialAddinsTest {

    public void init() {
        checkDragEvents();
        checkDropEvents();
        checkRestriction();
        checkInertia();
        checkAxis();
        checkDropzone();
    }

    protected void checkDropzone() {
        final String ACCEPT = "accept";
        final double OVERLAP = 20;
        MaterialPanel panel = new MaterialPanel();
        MaterialDnd dnd = MaterialDnd.dropzone(panel, JsDropOptions.create(ACCEPT, OVERLAP));
        JsDropOptions options = dnd.getDropOptions();
        assertEquals(options.accept, ACCEPT);
        assertEquals(options.overlap, OVERLAP);
    }

    protected void checkAxis() {
        final String VERTICAL_AXIS = "y";
        final String HORIZONTAL_AXIS = "x";
        MaterialPanel panel = new MaterialPanel();
        MaterialDnd dnd = MaterialDnd.draggable(panel, JsDragOptions.create(Axis.VERTICAL));
        assertEquals(dnd.getDragOptions().axis, VERTICAL_AXIS);
        dnd.getDragOptions().axis = HORIZONTAL_AXIS;
        assertEquals(dnd.getDragOptions().axis, HORIZONTAL_AXIS);
    }

    protected void checkInertia() {
        MaterialPanel panel = new MaterialPanel();
        MaterialDnd dnd = MaterialDnd.draggable(panel, JsDragOptions.create(true));
        assertTrue(dnd.getDragOptions().inertia);
        dnd.getDragOptions().inertia = false;
        assertFalse(dnd.getDragOptions().inertia);
    }

{'fraction_non_alphanumeric': 0.10331734612310152, 'fraction_numerical': 0.005195843325339729, 'mean_word_length': 3.604415823367065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4627904', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1461, 'n_words': 360}